Skip to content

fix(test): Stop ExampleEvent hanging when ticks beat registration - #79

Draft
Jrc356 wants to merge 1 commit into
mainfrom
jcorbin/fix-example-event-race
Draft

Jrc356 wants to merge 1 commit into
mainfrom
jcorbin/fix-example-event-race

Conversation

@Jrc356

@Jrc356 Jrc356 commented Sep 23, 2026

Copy link
Copy Markdown

ExampleEvent hangs until the 10m test timeout on Windows CI. It hit main in run 32182612530 (both Windows jobs), and #78 in run 35921918139.

  • Cause: the handler flushes the response headers before it registers the subscriber. Subscribe can therefore return, and the publisher can send all five 1ms ticks, before the subscriber is registered. Every tick then reaches nobody, and the example waits on stream.Events forever.
  • Fix: register a Repository that replays nothing and set ReplayAll. The Server calls Replay only after it adds the subscriber, so the example starts publishing only after that call.
  • Proof: in a scratch copy I added a 50ms sleep between the header flush and registration. The old example hangs until the test timeout; the new one passes in 0.4s.

ExampleRepository publishes right after Subscribe in the same way. It hasn't failed in CI, and this PR leaves it alone.

🤖 Generated with Claude Code

The Server registers a subscriber only after it flushes the response
headers, so Subscribe can return before events are deliverable. The
publisher's five 1ms ticks could all reach nobody, leaving the example
waiting forever; Windows CI hit this and timed out after 10m. Start
publishing once a Repository's Replay call shows the subscriber is
registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant