Repository navigation
Meetups: a join aborted by the crowd waits and tries again - #321
Conversation
Everyone joining one meetup reads and writes the same document. On the test project, 199 people joined a meetup for twenty at once, and two of the joins were aborted for contention after the client library's own retries. Those two were told "internal" instead of that the meetup was full. The join now runs through retryOnContention, the wait-and-try-again that runEventOnce already used, moved out so both share it. Running a join again is safe: someone already on the roster is answered as joined. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c600bbd18
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| afterAll(async () => { | ||
| await purge(MEETUP, `users/${ORGANIZER}`, `users/${JOINER}`, `pets/${petId}`); |
There was a problem hiding this comment.
Clean up every generated pet after each test
Each beforeEach creates a new random pet, but this afterAll deletes only the ID from the final test, leaving the first test's pet behind. When this test file is rerun against the same emulator, those leaked pets accumulate for jc-joiner until createPetCallable reaches its five-pet limit and the setup starts failing; delete the current pet in afterEach or retain and purge all generated IDs.
Useful? React with 👍 / 👎.
Everyone joining one meetup reads and writes the same meetup document.
On the test project, 199 people joined a meetup for twenty at once. Two joins were aborted for contention after the client library's own retries, so those two people were told
internalinstead of that the meetup was full. An earlier run of the same race had no errors, so it comes and goes.The fix:
joinMeetupCallablenow runs its transaction throughretryOnContention, which waits and tries again.runEventOncealready had that loop; it moves out intoshared.tsso both share it.Tests. Two new emulator tests. Each makes the transactions that read the meetup end as if the library had given up for contention, and leaves the rate limit's transaction alone.
Both tests fail on the old code. The full suite passes: 290 tests.
On the test project, with this deployed, the 200-person race: 180 told "Meetup is full.", 0 errors.
🤖 Generated with Claude Code