Repository navigation
Conversation
cdklabs-automation
enabled auto-merge
October 8, 2026 10:46
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
mrgrain
force-pushed
the
mrgrain/feat/npmjs/laggy-packument-queue
branch
from
October 8, 2026 14:03
47c9919 to
fa412e7
Compare
mrgrain
disabled auto-merge
October 9, 2026 09:23
This branch has not been deployed
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.
When the npm registry serves an older revision of a package than the changes feed announced, the follower processes what it got and checks the package again later. Until now it kept these "laggy packuments" in its state file and re-checked the 50 oldest on every run. Packages that never caught up held those slots for a day, so newer ones were not checked at all.
Laggy packuments now go to an SQS queue, and a new packument processor function works through it. It checks each package again with growing waits, from 5 minutes up to 11 hours. After about 27 hours it gives up, and the message moves to a dead-letter queue. The processor can run next to the follower now that known versions live in DynamoDB (#1941).
A 404 for a change entry used to be treated as a deleted package and ignored. Most of the time it is a new package that has not replicated to the registry yet, and prod sees a thousand or more of these a day. They now go through the same queue, but get their own metrics. Change entries marked as deleted are skipped completely.
Alarms
The dead-letter queue is graphed but doesn't get an alarm: with this many 404s, it seems useless. Instead we have low severity alarms aiming to detect npm outages and processing failures. Thresholds are based on a week of prod logs.
What's Next
This change deliberately only addresses laggy and missing packuments. I want to make sure the processing works as intended and observe for a bit. Once we are happy, the plan is to change the follower to do nothing more than reading the change stream and putting entries on the queue for the packument processor to pick up. This final step will make the architecture more resilient to outages: We have a single follower function that does the absolute minimum of work (read change stream, add to queue). Everything else happens detached in a queue processor and work can be fanned out. In theory this should also speed up ingestion from zero.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license