faktory-rs icon indicating copy to clipboard operation
faktory-rs copied to clipboard

Handle signals

Open jonhoo opened this issue 7 years ago • 1 comments

We should add a dependency on ctrlc so that the worker can be told to cleanly exit when run_to_completion is called. The implementation will likely be fairly straightforward, essentially just storing STATUS_TERMINATING and letting the heartbeat thread do the cleanup (including failing the currently execution job). This may require some minor changes to make the heartbeat thread recognize that this is indeed a forced exit.

We may also want to allow the user to opt-in to signal handling for run, although that's less clear (we might instead want to return some kind of handle that the caller can use to signal to exit or wait for termination).

jonhoo avatar Nov 03 '17 18:11 jonhoo

Suggesting to use signal and namely ctrl_c interceptor from tokio eco-system, since we are switching to async.

rustworthy avatar Mar 21 '24 07:03 rustworthy