fix: increase writeAuditEntry 412 retries to 5 and remove dead retry loop in put.js#274
Merged
Merged
Conversation
…loop in put.js Under high concurrency a single retry was insufficient to survive 412 PreconditionFailed on audit writes. writeAuditEntry now retries up to 4 times (5 total) with random jitter to reduce thundering-herd contention. The dead for-loop retry in put.js (AUDIT_WRITE_RETRIES) is removed since writeAuditEntry already catches and handles all errors internally. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
bosschaert
approved these changes
May 5, 2026
adobe-bot
pushed a commit
that referenced
this pull request
May 5, 2026
## [1.7.2](v1.7.1...v1.7.2) (2026-05-05) ### Bug Fixes * handle NoSuchKey error name in copyFile catch block ([#272](#272)) ([939b491](939b491)) * increase writeAuditEntry 412 retries to 5 and remove dead retry loop in put.js ([#274](#274)) ([2aca684](2aca684)) * return 400 when label is missing in POST /versionsource ([#273](#273)) ([36acb2b](36acb2b))
Collaborator
|
🎉 This PR is included in version 1.7.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
4 tasks
Collaborator
|
🎉 This PR is included in version 1.8.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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
writeAuditEntry412 retry limit from 1 to 4 additional retries (5 total attempts). Adds random jitter delay (Math.random() * 50 * (attempt + 1)ms) before each retry to reduce thundering-herd contention under high concurrency.AUDIT_WRITE_RETRIESfor-loop andauditErrvariable. SincewriteAuditEntryalready catches all errors internally (returning{ status: 500 }on failure, never throwing), the outer retry loop never fired. Replaced with a singleawait writeAuditEntry(...)call.Test plan
test/storage/version/audit.test.js: new tests verify 5-total-attempt exhaustion and success on the 5th attempt; updated existing retry test to reflect multi-retry behaviourtest/storage/version/put.test.js: removed tests that verified the dead retry loop; added tests confirmingput.jscallswriteAuditEntryexactly once and that a 500 return does not affect the main PUT resulttest/storage/object/conditionals.test.js: adjusted PUT command count to reflect 5 audit attempts (was 3 = 1 original + 1 retry + 1 main; now 6 = 5 audit attempts + 1 main)npm run lintpasses with no errorsnpm test— 370 tests passing🤖 Generated with Claude Code