Skip to content

fix: register a handler added from a handler at once, so it sees queued events - #466

Merged
devopvoid merged 1 commit into
mainfrom
fix/register-handlers-from-handlers
Oct 28, 2026
Merged

devopvoid merged 1 commit into
mainfrom
fix/register-handlers-from-handlers

Conversation

@devopvoid

Copy link
Copy Markdown
Owner

A handler registered from within another handler was queued behind the events already waiting, so it could miss them. onChannel → onMessage lost the kept messages when the channel closed over its receive limit before the registration ran, which made PeerTests.slowHandlerClosesChannel fail now and then (expected: <[0, 1, 2, 3]> but was: <[]>).

  • PeerImpl.subscribe registers at once when called on the peer's event executor, so the new handler sees every event queued behind the current one.
  • handlerAddedOnChannelGetsQueuedMessages holds the channel handler until the channel closed, which fails every time without the fix.

@devopvoid
devopvoid merged commit a634912 into main Oct 28, 2026
22 checks passed
@devopvoid
devopvoid deleted the fix/register-handlers-from-handlers branch October 28, 2026 15:51
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