Repository navigation
fix(usage): retry a usage write once when the database is locked - #16276
Merged
diegosouzapw merged 1 commit intoOct 13, 2026
Conversation
maxmad64bis
force-pushed
the
fix/usage-write-deferred-retry-on-lock
branch
from
October 10, 2026 21:51
1bb85ef to
c8da005
Compare
A write meeting a lock is deferred off the request path and attempted once more instead of being dropped.
maxmad64bis
force-pushed
the
fix/usage-write-deferred-retry-on-lock
branch
from
October 10, 2026 22:26
c8da005 to
6198f79
Compare
maxmad64bis
marked this pull request as ready for review
October 10, 2026 23:04
diegosouzapw
merged commit Oct 13, 2026
429e7f1
into
cheaper-inference:release/v3.8.52
119 of 200 checks passed
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
Usage rows went missing when the database was busy, since a locked write was logged and dropped. A write that meets a lock is now retried once after a short delay, off the request path, and it's dropped with the same log line when the second try meets a lock too. Builds on @W25X80's diagnosis from #16176.
Related Issues
Target Branch
release/v3.8.xbranch (the highest openrelease/v*), notmainv4-featurelabel for the v4 channelValidation
npm run lintTests Added Or Updated
tests/unit/usage/usageWriteRetry.test.ts— covers the lock check plus 5 write cases: lock then free writes one row, lock twice drops it with the log line and no third try, a non-lock error logs at once with no retry, a first-try success never writes twice, and the retry replays the first-try timestamp.Coverage Notes
src/lib/usage/usageWriteRetry.ts— covered bytests/unit/usage/usageWriteRetry.test.ts.src/lib/usage/usageHistory.ts— covered bytests/unit/usage/usageWriteRetry.test.tsand the existing usage suites.Reviewer Notes
src/lib/usage/usageWriteRetry.tsandtests/unit/usage/usageWriteRetry.test.ts.