Add new worker to back of fifo queue #93
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.
Observed situation where worker crashes and next client process gets the new worker. Unfortunately the new worker might be busy asynchronously starting, for example when the worker is setting up a tcp connection. If there is another worker it would be nice for the client to get that worker as it is more likely to be ready. Using the
fifo
strategy fits nicely with the existing options to help solve this as other workers will be checked out before the new worker - if there are any.This fix is also useful to avoid the problem that can occur when using
lifo
queues where a client times out on a call and the worker gets checked back in. If the next client gets the "slow" worker it is also likely to timeout. This can lead to a grouping of timeouts until the worker catches up or crashes. This patch allows to isolate that timeout as much as possible by using a combination offifo
queue andgen_server:stop/3
orexit/2
before checking in the worker because the replacement worker is put at the back of the worker queue.