@@ -30,13 +30,6 @@ function parseMaxDurationMs(value: string | undefined): number {
3030 return parsed ;
3131}
3232
33- function parseStopWhenIdle ( value : string | undefined ) : boolean {
34- if ( ! value ) return false ;
35- if ( value === "true" ) return true ;
36- if ( value === "false" ) return false ;
37- throw new StatusError ( 400 , "stopWhenIdle must be 'true' or 'false'" ) ;
38- }
39-
4033function directSyncEnabled ( ) : boolean {
4134 return getEnvVariable ( DIRECT_SYNC_ENV , "" ) === "true" ;
4235}
@@ -69,7 +62,6 @@ export const GET = createSmartRouteHandler({
6962 } ) . defined ( ) ,
7063 query : yupObject ( {
7164 maxDurationMs : yupString ( ) . optional ( ) ,
72- stopWhenIdle : yupString ( ) . optional ( ) ,
7365 } ) . defined ( ) ,
7466 } ) ,
7567 response : yupObject ( {
@@ -91,13 +83,11 @@ export const GET = createSmartRouteHandler({
9183 return await traceSpan ( "external-db-sync.poller" , async ( span ) => {
9284 const startTime = performance . now ( ) ;
9385 const maxDurationMs = parseMaxDurationMs ( query . maxDurationMs ) ;
94- const stopWhenIdle = parseStopWhenIdle ( query . stopWhenIdle ) ;
9586 const pollIntervalMs = 50 ;
9687 const staleClaimIntervalMinutes = 5 ;
9788 const pollerClaimLimit = getPollerClaimLimit ( ) ;
9889
9990 span . setAttribute ( "stack.external-db-sync.max-duration-ms" , maxDurationMs ) ;
100- span . setAttribute ( "stack.external-db-sync.stop-when-idle" , stopWhenIdle ) ;
10191 span . setAttribute ( "stack.external-db-sync.poll-interval-ms" , pollIntervalMs ) ;
10292 span . setAttribute ( "stack.external-db-sync.poller-claim-limit" , pollerClaimLimit ) ;
10393 span . setAttribute ( "stack.external-db-sync.direct-sync" , directSyncEnabled ( ) ) ;
@@ -235,7 +225,7 @@ export const GET = createSmartRouteHandler({
235225 }
236226
237227 type PollerIterationResult = {
238- stopReason : "disabled" | "idle" | null ,
228+ stopReason : "disabled" | null ,
239229 processed : number ,
240230 } ;
241231
@@ -255,10 +245,6 @@ export const GET = createSmartRouteHandler({
255245 const pendingRequests = await claimPendingRequests ( ) ;
256246 iterationSpan . setAttribute ( "stack.external-db-sync.pending-count" , pendingRequests . length ) ;
257247
258- if ( stopWhenIdle && pendingRequests . length === 0 ) {
259- return { stopReason : "idle" , processed : 0 } ;
260- }
261-
262248 const processed = await processRequests ( pendingRequests ) ;
263249 iterationSpan . setAttribute ( "stack.external-db-sync.processed-count" , processed ) ;
264250 return { stopReason : null , processed } ;
0 commit comments