Skip to content

Channel and Dataflow pumps: drop the first-wait flags - #281

Merged
electricessence merged 1 commit into
masterfrom
refactor/pump-tidy
Dec 1, 2026
Merged

electricessence merged 1 commit into
masterfrom
refactor/pump-tidy

Conversation

@electricessence

Copy link
Copy Markdown
Collaborator

ChannelPump.Run and BlockPump.Run each took a flag (waitFirst, checkOpen) that was false at exactly one caller and true at every other. The flags are removed: a pass now always does the first WaitToWriteAsync (channel) or the completed-check (block).

The one false caller in each package creates a fresh channel or block, so the wait returns at once and the block is not completed: no change for them. One edge differs: a block created with options whose cancellation token is already cancelled is already completed. Its pass now returns 0 without running a command; before, it ran the query and stopped at the first row. The block ends cancelled either way.

Not done: a shared frame for the two pumps. The try / record-error / rethrow / finally-complete frame is about 20 lines per package. Sharing it would need a Core frame, a feed interface generic over the target type, and a small adapter per package for "wait for room or check completed" and "complete or fault". That adds about as many lines as it removes, and splits one short frame across projects. The per-row loops stay per package either way. Left as two copies.

No public API change. 8 lines added, 23 removed.

Tested on net11.0: Core.Tests passes in Release (15571 passed) and Debug (15554 passed, 16 skipped, none failing). Core, Channel and Dataflow build with 0 warnings and 0 errors, style enforced.

🤖 Generated with Claude Code

ChannelPump.Run and BlockPump.Run took a flag (waitFirst, checkOpen) that
was false at exactly one caller each: the call that makes a fresh channel
or block. Every other caller passed true. The flag is gone; the pass now
always does the first WaitToWriteAsync (a channel) or the completed-check
(a block). On a fresh channel the wait returns at once and the block is not
completed, so the behavior of those two callers is unchanged.

One edge differs: a block created with options whose cancellation token is
already cancelled is already completed. The pass now returns 0 without
running a command; before, it ran the query and stopped at the first row.
The block ends cancelled either way.

The shared frame between the two pumps is left as two copies: a Core frame
would need a feed interface over the target type plus a small adapter per
package, which adds about what it removes and splits one short frame
across projects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@electricessence
electricessence merged commit dbb1971 into master Dec 1, 2026
9 checks passed
@electricessence
electricessence deleted the refactor/pump-tidy branch December 1, 2026 20:48
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