Increase content sanitizer timeout to 60s, add trackPoints - #89
Merged
Conversation
Adds trackPoint() calls at each step of processEmail (MIME fetch, parse, attachment validation/upload, HTML sanitization, link extraction, asset extraction, response assembly) and emits a TRACK log with the full trackPoints timeline when a content-sanitizer invocation runs past 50s, mirroring the api.slow_request pattern used for the main lambda.
A finally block (or any code placed after "await work") never runs if work hangs forever — the await itself never returns, so a genuinely stuck invocation would silently run out the Lambda clock with no TRACK log at all, the one case this logging exists to catch. Replace the post-await elapsed check in both the content sanitizer and the api.slow_request middleware with a setTimeout that fires independently at the threshold, regardless of whether the awaited work ever settles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
content_sanitizerLambda timeout from 10s to 60s (deploy/compute.tf)logger.trackPoint()calls at every meaningful step ofprocessEmailinsrc/isolated/content-sanitizer.ts(MIME fetch, MIME parse, attachment-limit validation, attachment processing/upload, HTML sanitization, link extraction from HTML/text, header extraction, asset extraction, response assembly)TRACKlog (content_sanitizer.slow_invocation) with the full trackPoints timeline whenever an invocation runs past 50s, mirroring the existingapi.slow_requestpattern insrc/api/app.tsTest plan
npx tsc --noEmitpassesnpx eslint src/isolated/content-sanitizer.tspasses cleannpx vitest run tests/isolated/content-sanitizer-text-only.spec.ts tests/processor/content-sanitizer-client.spec.ts— 4/4 passGenerated by Claude Code