Open ThisIsMissEm opened 5 months ago
I believe this is due to this exit
handler not being aware that Bree is attempting to shutdown:
https://github.com/breejs/bree/blob/master/src/index.js#L469
PR welcome + added test case would be great too 🙏
PR welcome + added test case would be great too 🙏
If I'm gonna be working on scheduler code, I'll write it from scratch and ditch Bree completely, tbh. I've been trying to avoid writing this code.
Best of luck
Describe the bug
Node.js version: 20
OS version: n/a — happens on both mac and linux
Description:
When the main Bree process is terminated with
ctrl+c
(SIGINT), usinggraceful
, the worker process is told to terminate, which results in it exiting with a 1 exit code, even though it was terminated by the main process.This results in the
errorHandler
option receiving aWorker for job "BackgroundJob" exited with code 1
messageActual behavior
The logs printed during graceful termination look like the following (here I'm using pino with pino-pretty as the logger:
Expected behavior
Bree should be aware that it requested the job to terminate, and therefore not treat this exit code of 1 as an error, i.e., it should actually gracefully shut down.
Per the node.js Worker documentation:
Code to reproduce
It doesn't matter what "BackgroundJob" actually does.
Checklist