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.
This PR introduces a new pool argument,
lazy
, which, when set totrue
, causes the workers to be started in a lazy fashion. Default isfalse
, which results in currentpoolboy
behavior.In detail, this means that workers are not pre-emptively started on pool start, but on checkout, similar to overflow workers; other than overflow workers, however, they remain active when returned to the pool. When a worker exits, it won't be restarted unless checked out again.
My use case that prompted me to pick this up is like this: I use
poolboy
to pool MySQL connections, under a supervisor of my application. The database is hosted in a cloud environment, ie unreliable, so it may go down or become otherwise unreachable without warning, and the workers will exit. Failure to re-start the workers will cause the pool to crash, and failure to start workers on pool restart will cause it to crash repeatedly, until my supervisors' restart frequency is reached and, in essence, the entire application is taken down.This is a work in progress, and tests are still missing. Just wanted to show it and ask for comments before I start putting more work into it.