inaka / worker_pool

Erlang worker pool
https://hex.pm/packages/worker_pool
Apache License 2.0
276 stars 80 forks source link

Add option 'worker_shutdown' #171

Closed sirihansen closed 4 years ago

sirihansen commented 4 years ago

The shutdown option in the child specs for each worker is hardcoded to 5000 ms. If something is slow during shutdown, this may add up to quite a lot depending on the number of workers. In my case I want to allow the workers to empty their inboxes on controlled termination so I don't want to use the default brutal_kill for the supervisor, but I also don't want to allow too much time if something hangs or is slow during this cleanup.

This PR includes:

codecov[bot] commented 4 years ago

Codecov Report

Merging #171 into master will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #171   +/-   ##
=======================================
  Coverage   96.35%   96.36%           
=======================================
  Files          10       10           
  Lines         439      440    +1     
=======================================
+ Hits          423      424    +1     
  Misses         16       16           
Impacted Files Coverage Δ
src/wpool_process_sup.erl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 90af3ad...cb94d4e. Read the comment docs.

elbrujohalcon commented 4 years ago

@sirihansen I'm inclined to merge this PR, but I'll wait in case you want to fix the description in the readme as you proposed.

elbrujohalcon commented 4 years ago

No need for squashing. Thanks, @sirihansen :) I'll merge and generate a new release later today.

elbrujohalcon commented 4 years ago

Published: https://hex.pm/packages/worker_pool/4.0.2