breejs / bree

Bree is a Node.js and JavaScript job task scheduler with worker threads, cron, Date, and human syntax. Built for @ladjs, @forwardemail, @spamscanner, @cabinjs.
https://jobscheduler.net
MIT License
3.01k stars 78 forks source link

[fix] Event 'worker deleted' not emitted for 'done' workers #151

Closed hnougher closed 2 years ago

hnougher commented 2 years ago

Describe the bug

Event 'worker deleted' not emitted when the job naturally ends via the 'done' message.

Expected behaviour

Event for 'worker deleted' should emit for all cases a worker is deleted.

Code change suggestion

My guess is this area needs an emitter https://github.com/breejs/bree/blob/d95f20fac1a514e9e67e09e3926111cb6e9735ce/src/index.js#L336

Example of the other emitter, which in my trial worked OK by putting after above line. https://github.com/breejs/bree/blob/d95f20fac1a514e9e67e09e3926111cb6e9735ce/src/index.js#L390

mihai-vlc commented 2 years ago

Hi @shadowgate15 ,

https://github.com/breejs/bree/commit/79ce6a87f6b732b05f962e93abe311d20460283b#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R350

In this scenario it looks like the worker deleted is missing the job name as a parameter.

shadowgate15 commented 2 years ago

fixed in v7.1.5