Repository navigation
Conversation
Motivation: An outstanding eager upstream pull can race with materialization of the selected sink. Modification: Reuse the outstanding pull and wait for inner demand before forwarding a buffered element. Keep the final element until it has been delivered before normal completion. Cover both arrival orders and the normal completion boundary with directional tests. Result: Eager prefetch is preserved without a duplicate pull, loss of the first element, or a public API change. Tests: The preceding revision's functional CI passed. Scoped ScalaFmt 3.11.5 passed for this revision; its sole delta is a whitespace-only test constructor wrap with identical parsed Scala AST. References: Refs playframework/playframework#13793.
He-Pin
force-pushed
the
fix/eager-future-sink-demand-handoff
branch
from
November 29, 2026 06:13
46e5082 to
43830ac
Compare
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.
Motivation
Sink.eagerFutureSinkpulls from upstream before the future supplies the inner sink. When the inner sink materializes, the handoff must preserve that outstanding pull and respect the inner sink's demand.Modification
Reuse the outstanding upstream pull. If an element arrives before the inner sink requests it, keep it buffered. On normal upstream completion, deliver any buffered element on demand before completing. Leave the public API, failure propagation, and cancellation behavior unchanged.
Result
The handoff neither issues a duplicate pull nor drops a buffered final element on normal completion. Three regression tests exercise the real operator: inner demand first, an upstream element first, and upstream completion with an element buffered.
The three new Scala 2.13 regression tests passed before the test-only formatting update. On the current commit, Scalafmt, Code Style, and binary compatibility passed. See Checks for the full CI status.
References
Refs playframework/playframework#13793.