allow for overflow worker start failure #124
Open
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.
As described in #122, if an overflow worker was unable to start (which may always happen owing to circumstances), the
poolboy
gen_server
would crash, because it invariably expects{ok, Pid}
to be returned fromsupervisor:start_child/2
in thenew_worker/1
function. That is even though the spec for thepoolboy_worker:start_link/1
callback function explicitly allows{error, term()}
to be returned.This PR changes this in that it really allows error tuples to be returned from the worker start functions. If an overflow worker fails to start in response to a
checkout
ortransaction
request, anexit
exception will be raised in the client instead. Failure to start a residual worker on pool start, or restart of an exited residual worker, will still cause a crash of the pool as before. I think that is what is to be expected, and it can be provided for when needed with the other PR (#123) that I recently submitted.