Automattic / kue

Kue is a priority job queue backed by redis, built for node.js.
http://automattic.github.io/kue
MIT License
9.46k stars 867 forks source link

Is there any specific reason to not to call Worker.prototype.shutdown directly? #1161

Closed zignd closed 3 years ago

zignd commented 6 years ago

I have a use case in which I will stop saving jobs of a specific type after a certain point in the application lifecycle; also, this point is not predictable. At this point, I'd like to release the resources consumed by this Worker instance. I checked the source code, and it seems that there's a Worker.prototype.shutdown, which is invoked on all Worker instances inside the Queue singleton when Queue.prototype.shutdown is called.

From what I could understand, it seems to be safe to call Worker.prototype.shutdown on my own, do you guys confirm my understanding? Also, in case of a positive answer, wouldn't it be useful for other users as well, to function document this function in the README.md?