@@ -170,13 +170,11 @@ export async function handler(event: APIGatewayProxyEvent, context: Context): Pr
170170
171171 const screenedAttachments : AttachmentRecord [ ] = [ ] ;
172172
173- // Internal deadline timer (design §ConfirmUploadsFunction): abort screening
174- // before the Lambda times out so we can return a graceful 503 + Retry-After
175- // instead of an opaque timeout error. On retry, already-screened attachments
176- // (status === 'passed' in DDB) are skipped, so retries make forward progress.
177- const deadlineMs = context . getRemainingTimeInMillis ( ) - DEADLINE_MARGIN_MS ;
178-
179- // Process in batches of SCREENING_CONCURRENCY
173+ // Process in batches of SCREENING_CONCURRENCY.
174+ // Deadline check: abort screening before the Lambda times out so we can
175+ // return a graceful 503 + Retry-After instead of an opaque timeout error.
176+ // On retry, already-screened attachments (status === 'passed' in DDB) are
177+ // skipped, so retries make forward progress.
180178 for ( let i = 0 ; i < pendingAttachments . length ; i += SCREENING_CONCURRENCY ) {
181179 // Deadline check before starting a new batch
182180 if ( context . getRemainingTimeInMillis ( ) <= DEADLINE_MARGIN_MS ) {
@@ -186,7 +184,7 @@ export async function handler(event: APIGatewayProxyEvent, context: Context): Pr
186184 task_id : taskId ,
187185 screened,
188186 remaining,
189- deadline_ms : deadlineMs ,
187+ remaining_ms : context . getRemainingTimeInMillis ( ) ,
190188 request_id : requestId ,
191189 metric_type : 'confirm_uploads_deadline_exceeded' ,
192190 } ) ;
0 commit comments