Repository navigation
deliveries_rpc test: stamp claim setups by the wall clock - #275
Merged
Merged
Conversation
claim_deliveries ages rows, refills buckets and lifts throttles by clock_timestamp(), but the queue helper and the refill, batch hold, throttle and expiry setups stamped rows with the transaction's now(). When a runner is slow to reach those tests (three CI runs on 2026-10-27 took 82 to 215 s for the file; it usually takes 2), a fresh row looked older than the batch hold and 19 tests failed. Stamp them with clock_timestamp() so the file passes however long it runs; checked with a 100 s pg_sleep after plan(), which fails the old file the same 19 ways. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Updates to Preview Branch (deliveries-test-clock) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
This branch was successfully 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.
Fixes the
deliveries_rpc.test.sqlflake that has turned main red (the merge of #273, and earlier the 00:00Z run on 2026-10-27) and failed #274's CI.Cause.
claim_deliveriesreadsclock_timestamp()for everything: row age, bucket refill, the batch hold and throttles. The test'squeuehelper inserted deliveries withcreated_atdefaulting to the transaction'snow(), and the refill, hold, throttle and expiry setups usednow()too. The file usually takes 2 s, but three CI runs took 82 to 215 s to get through it. Once more than about 30 s had passed by the "Refill" section, fresh rows looked older than the 30-second hold and refills looked bigger than intended, so tests 64 to 108 failed, 19 in all.Fix (test only). The
queuehelper stampscreated_atwithclock_timestamp(), and every setup a claim reads is stamped by the wall clock. Assertions aboutthrottle_destination,mark_deliveries_sentanddelivery_queue_statskeepnow(), since those functions readnow().Checked. A 100 s
pg_sleepafterplan()fails the old file in exactly CI's 19 tests and passes the new one, 145/145. The full pgTAP suite passes locally.Not fixed: why the file sometimes runs slow. Locally, one run in about a hundred spent 2.4 s in a single
claim_deliveriescall, against the usual 100 ms, shortly after adb reset. That points to plans made while autovacuum was still analyzing the freshly seeded tables, which a hosted database with settled statistics doesn't hit. I could not reproduce it on demand.🤖 Generated with Claude Code