File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export class TimerWheel<T> {
4646 this . cursor = 0 ;
4747 this . intervalId = null ;
4848 this . onExpire = opts . onExpire ;
49- this . delaySlots = Math . max ( 1 , Math . min ( NUM_SLOTS , Math . round ( opts . delayMs / TICK_MS ) ) ) ;
49+ this . delaySlots = Math . max ( 1 , Math . min ( NUM_SLOTS , Math . ceil ( opts . delayMs / TICK_MS ) ) ) ;
5050 }
5151
5252 /** Start the timer wheel. Must be called before submitting items. */
@@ -88,7 +88,7 @@ export class TimerWheel<T> {
8888 * Clamped to [TICK_MS, 60000ms].
8989 */
9090 setDelay ( delayMs : number ) : void {
91- this . delaySlots = Math . max ( 1 , Math . min ( NUM_SLOTS , Math . round ( delayMs / TICK_MS ) ) ) ;
91+ this . delaySlots = Math . max ( 1 , Math . min ( NUM_SLOTS , Math . ceil ( delayMs / TICK_MS ) ) ) ;
9292 }
9393
9494 /**
Original file line number Diff line number Diff line change @@ -129,7 +129,15 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
129129 if ( this . computeManager && env . COMPUTE_SNAPSHOTS_ENABLED ) {
130130 this . snapshotDelayWheel = new TimerWheel < DelayedSnapshot > ( {
131131 delayMs : env . COMPUTE_SNAPSHOT_DELAY_MS ,
132- onExpire : ( item ) => this . dispatchComputeSnapshot ( item . data ) ,
132+ onExpire : ( item ) => {
133+ this . dispatchComputeSnapshot ( item . data ) . catch ( ( error ) => {
134+ this . logger . error ( "Compute snapshot dispatch failed" , {
135+ runId : item . data . runFriendlyId ,
136+ runnerId : item . data . runnerId ,
137+ error,
138+ } ) ;
139+ } ) ;
140+ } ,
133141 } ) ;
134142 this . snapshotDelayWheel . start ( ) ;
135143 }
@@ -296,7 +304,14 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
296304 this . logger . error (
297305 "TRIGGER_WORKLOAD_API_DOMAIN is not set, cannot create snapshot callback URL"
298306 ) ;
299- reply . json ( { error : "Snapshot callbacks not configured" } , false , 500 ) ;
307+ reply . json (
308+ {
309+ ok : false ,
310+ error : "Snapshot callbacks not configured" ,
311+ } satisfies WorkloadSuspendRunResponseBody ,
312+ false ,
313+ 500
314+ ) ;
300315 return ;
301316 }
302317
You can’t perform that action at this time.
0 commit comments