fix
patch
billing
feat/phase-2g-bundle
fix(billing): fix index job counter race condition on Netlify Blobs
The gateway's index route called runBillingGate (which wrote the billing DB with monthly_index_jobs_used++) and then called recordIndexingTokensAfterBridgeIndex (which called mutateBillingDb). With Netlify's eventually-consistent Blob store, the second read could return a stale snapshot, causing the final write to overwrite the job counter back to 0 — silently resetting it on every index operation.
Fix: remove monthly_index_jobs_used from the billing middleware for the 'index' op, and increment it atomically alongside monthly_indexing_tokens_used in a single mutateBillingDb call inside recordIndexingTokensAfterBridgeIndex. One read-modify-write per index operation, no race possible.
sha256:5815886e2c3cec40afb527b6f9b9f8a6c660739a1288942343890399a943ec33
sha
sha256:33b4c1694de9324ca92e9a3e21ca84b6d1c9b8dfe8b8c272dbea5d254dd7876a
snapshot
0 comments
To add a comment, use the Muse CLI:
muse hub commit comment sha256:5815886e2c3cec40afb527b6f9b9f8a6c660739a1288942343890399a943ec33 --body "your comment"
No comments yet. Be the first to start the discussion.