Repository navigation
Conversation
kinyoklion
approved these changes
Nov 3, 2026
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.
Summary
Behavior change: compared with the released 7.21.2, FDv2 status listeners that are still reading now receive an
Offstatus when the client closes. Their channels then close as before. 7.21.2 neither broadcastOffnor set it on shutdown. #489 added a blocking broadcast that could hangClose(), and #498 removed it.This PR adds
Broadcaster.CloseWith, which sends a final value to each listener that has room for it in its buffer and then closes every listener channel. It never waits for a listener to read, so a listener that has stopped reading still can't blockClose(). That listener missesOffand only sees its channel close.The data system uses it in
Stop()to send theOffstatus. As a result, aWaitFor(DataSourceStateOff, ...)call that's running when the client closes now returnstrue.Note
Overview
On shutdown, FDv2 now pushes an
Offdata-source status to status listeners that still have buffer space, then closes their channels as before.WaitFor(DataSourceStateOff, …)can returntruewhen the client stops instead of only seeing the channel close.This is implemented with a new
Broadcaster.CloseWith: it non-blockingly tries to enqueue one final value per subscriber (drops it if the buffer is full), then closes all listener channels.Stop()recordsOffviamaybeUpdateStatusand passes that status intobroadcasters.Close(status), which usesCloseWithonly for the data-source status broadcaster; other broadcasters still use plainClose.Tests cover
CloseWith(delivery when there is room;Stop/CloseWithnever waits on a full listener) and FDv2 (listener getsOffthen close;WaitFor(Off)succeeds on stop).Reviewed by Cursor Bugbot for commit af42e38. Bugbot is set up for automated code reviews on this repo. Configure here.