poolboy icon indicating copy to clipboard operation
poolboy copied to clipboard

WIP: lazy worker start

Open juhlig opened this issue 5 years ago • 0 comments

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 avatar Mar 21 '19 13:03 juhlig