Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: lazy worker start #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

juhlig
Copy link

@juhlig juhlig commented Mar 21, 2019

This PR introduces a new pool argument, lazy, which, when set to true, causes the workers to be started in a lazy fashion. Default is false, which results in current poolboy 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.

@juhlig juhlig force-pushed the lazy_worker_start branch from b4c345f to ce31368 Compare March 26, 2019 12:44
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