contribsys / faktory_worker_go

Faktory workers for Go
Mozilla Public License 2.0
242 stars 43 forks source link

Implement hard shutdown #77

Closed mperham closed 9 months ago

mperham commented 9 months ago

Implement hard shutdown timeout of 25 seconds.

Your job funcs should implement context package semantics. If you use Manager.Run, FWG will now gracefully shutdown. After a default delay of 25 seconds, FWG will cancel the root Context which should quickly cancel any lingering jobs running under that Manager. If your jobs run long and do not respond to context cancellation, you risk orphaning any jobs in-progress. They will linger on the Busy tab until the job's reserve_for timeout.

Please also note that Manager.RunWithContext added in 1.6.0 does not implement the shutdown delay but the README example contains the code to implement it.

Fixes #76