feat(dealer): support runtime concurrency changes and injected Lanes - #961
Merged
Conversation
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).
…it deal() resolves
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
Dealer#setLimit()/Dealer#limitto change worker concurrency mid-run, guarded against reentrant#deal()calls so a synchronoussetLimit()from within a worker's ownstart()still dispatches deterministically.Lanes#footer()(andclear({ footer })) as a fixed line rendered below the log lanes, symmetric withheader().DealOptions.lanes(reuse an existingLanesinstance —deal()neither creates nor disposes it) andDealOptions.onStart(receive aDealControllerright beforedealer.play(), to callsetLimit()from an external event whiledeal()is still running).All additions — no existing behavior changes.
@d-zero/dealeris 1.13.1 (stable); this is a minor-version feature addition.Test plan
yarn test(full repo, 2058 tests) passesyarn build(full repo) passesyarn lint(full repo) passessetLimitmid-run, invalid values, post-finish no-op, the reentrant-call case,Lanes#footerordering/multi-line/clear/verbose no-op, injectedLanesnot disposed bydeal(),onStartfiring beforeplay()andsetLimitreflected in theheadercallback