Skip to content

feat(dealer): support runtime concurrency changes and injected Lanes - #961

Merged
YusukeHirao merged 2 commits into
devfrom
feat/dealer-runtime-limit-and-footer
Sep 8, 2026
Merged

feat(dealer): support runtime concurrency changes and injected Lanes#961
YusukeHirao merged 2 commits into
devfrom
feat/dealer-runtime-limit-and-footer

Conversation

@YusukeHirao

Copy link
Copy Markdown
Member

Summary

  • Add Dealer#setLimit() / Dealer#limit to change worker concurrency mid-run, guarded against reentrant #deal() calls so a synchronous setLimit() from within a worker's own start() still dispatches deterministically.
  • Add Lanes#footer() (and clear({ footer })) as a fixed line rendered below the log lanes, symmetric with header().
  • Add DealOptions.lanes (reuse an existing Lanes instance — deal() neither creates nor disposes it) and DealOptions.onStart (receive a DealController right before dealer.play(), to call setLimit() from an external event while deal() is still running).

All additions — no existing behavior changes. @d-zero/dealer is 1.13.1 (stable); this is a minor-version feature addition.

Test plan

  • yarn test (full repo, 2058 tests) passes
  • yarn build (full repo) passes
  • yarn lint (full repo) passes
  • New tests cover: increasing/decreasing setLimit mid-run, invalid values, post-finish no-op, the reentrant-call case, Lanes#footer ordering/multi-line/clear/verbose no-op, injected Lanes not disposed by deal(), onStart firing before play() and setLimit reflected in the header callback

Add Dealer#setLimit()/#limit to change worker concurrency mid-run, with
a reentrancy guard so a synchronous call from within a worker's own
start() still dispatches deterministically. Add Lanes#footer() (and
clear({footer})) as a fixed line below the log lanes, and DealOptions
.lanes/.onStart so a caller can reuse an existing Lanes instance and
get a DealController to call setLimit() from an external event (e.g.
a CLI reading stdin while a deal() is in flight).
@YusukeHirao
YusukeHirao merged commit 0235cb9 into dev Sep 8, 2026
7 checks passed
@YusukeHirao
YusukeHirao deleted the feat/dealer-runtime-limit-and-footer branch September 8, 2026 09:54
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