Repository navigation
feat(task): add App::task_pool_keep_threads and tidy retiring workers - #3307
Merged
Merged
Conversation
Add App::task_pool_keep_threads(usize) (default 2, ignored on web) so apps can choose how many idle rune-task workers stay alive between bursts (0 lets every worker retire 10 seconds after its last task and respawn on demand). Also update native task-pool workers at every keep count to: - run task::on_idle on exit whenever work ran since their last tidy, even if the periodic tidy timer was not yet due - count the 10-second linger from each worker's last task rather than from its last wake (spurious wakes, stolen notifies, or keep changes) Fixes #3294
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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
App::task_pool_keep_threads(usize)(default2, ignored onwasm32) to control how many idle nativerune-taskworkers stay alive between bursts. Passing0lets every worker retire 10 seconds after its last task and starts a new worker on demand for subsequent tasks.task::on_idleon exit whenever they ran work since their last tidy, whether or not the periodic tidy timer (IDLE/IDLE_MIN_GAP) was due.task_pool_keep_threadsupdates never restart a full linger.rune_core::task::poolaround a testablePoolwith a tidy-hook seam and add focused unit tests covering zero-keep drain/reuse, scale-up/scale-down floor retention, tidy-on-exit (withkeep = 1,keep = 0, already-tidied, andIDLE_MIN_GAPcases), linger anchoring across wakes,Tidytransitions, andApp::task_pool_keep_threads.Verification
cargo test -j 1 -p rune-core --lib task::pool(7 passed)cargo clippy -j 1 -p rune-core --lib --tests --no-depscargo test -j 1 -p rune --lib app::tests::task_pool_keep_threads(1 passed)cargo clippy -j 1 -p rune --lib --tests --no-depscargo check -j 1 -p rune --target wasm32-unknown-unknownscripts/file-size.sh(0 errors, 0 folder-shape issues)Fixes #3294