Skip to content

Commit ea8ad44

Browse files
author
bgagent
committed
chore(review): update package and variable
1 parent 4f410af commit ea8ad44

3 files changed

Lines changed: 348 additions & 22 deletions

File tree

cdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@aws-sdk/client-s3": "^3.1021.0",
2626
"@aws-sdk/client-secrets-manager": "^3.1021.0",
2727
"@aws-sdk/lib-dynamodb": "^3.1021.0",
28-
"@aws-sdk/s3-presigned-post": "3.1040.0",
28+
"@aws-sdk/s3-presigned-post": "^3.1021.0",
2929
"@aws-sdk/s3-request-presigner": "^3.1021.0",
3030
"@aws/durable-execution-sdk-js": "^1.1.0",
3131
"@cedar-policy/cedar-wasm": "4.10.0",

cdk/src/handlers/confirm-uploads.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)