Conversation
While the Broadcast is still open, maintain buffered data when consumer count reaches zero Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode
Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode
Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode
Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66028 +/- ##
==========================================
+ Coverage 90.22% 90.24% +0.01%
==========================================
Files 787 787
Lines 270307 270349 +42
Branches 51726 51749 +23
==========================================
+ Hits 243890 243979 +89
+ Misses 16899 16846 -53
- Partials 9518 9524 +6
🚀 New features to boost your workflow:
|
panva
reviewed
Sep 15, 2026
Comment on lines
+608
to
+612
| while (self.#bufferedBytes >= self.#options.budget && | ||
| !self.#sourceExhausted && | ||
| !self.#cancelled && | ||
| self.#sourceError === kNoShareError) { | ||
| self.#pullFromSource(true); |
Member
There was a problem hiding this comment.
This loop cannot make buffer space: discarded entries do not reduce #bufferedBytes, and a slow consumer cannot advance while this synchronous next() is running. With an infinite generator yielding 16 KiB batches, a 16 KiB budget, and two consumers, the fast consumer's second next() loops forever. It also drains the entire remainder of a large finite source in one call.
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.
Another batch of iterable streams fixes. See each commit.