refactor(pool): simplify lifecycle and maintenance semantics - #180
Merged
Conversation
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
last_usedadvances when a checkout is returned,retaininvokeson_detachedafter releasing the pool lock, and status snapshots report exact tracked and idle object counts.replenishpath with falliblereplenish_to, which reserves up to the immediately available capacity in one operation and reports manager creation errors.try_getfor manually populated unbounded pools and support managed values that areSendwithout also requiringSync.API notes
bounded::PoolStatus::wait_countis removed because it was approximate and required bookkeeping on every checkout.bounded::Pool::replenishbecomesreplenish_toand returnsResult<usize, M::Error>.unbounded::Pool<T>::try_getprovides the non-waiting manual-pool path.These APIs were introduced in the current unreleased cycle by #177, so this PR refines them before their first release.
Timeouts, task spawning, periodic retention/replenishment, and other runtime policy remain outside the pool and compose around its futures. This is a follow-up to #177 and is related to the broader scope discussion in #176.
Validation
cargo x checkcargo x testcargo x lintcargo bench -p benchmarks --bench benchmarks -- pool --testcargo package -p asyncbandcargo tree -p asyncband --no-default-features --features pool -e normal(no normal dependencies)