#With nestjs/schedule, is it possible to stop a running job?

4 messages · Page 1 of 1 (latest)

prime hare
#

The dynamic scheduling features only seem to adding or removing from the cron schjedule. I could not figure out if it was possible to kill an active job that as run for too long.

My team at work is trying to assess whether it is feasible to implement a job queue for recurring tasks on top of the schedule package, or worth it to go ahead and use bullmq.

I think BullMQ is a decent fit for our problem, but I'm exploring nestjs/schedule first, simply because it would make our deployment process simpler if we do not incur a dependency on Redis.

flat surge
#

You could try with AbortController. I don't have any example though, just a thought.

prime hare
#

Ok, so you it looks like for Abort Controller every async method that's used in a job would have be to designed to cooperate with AbortController. There's no way to reach into the node event loop and kill the running action otherwise?

cyan halo
#

There's no way to reach into the node event loop and kill the running action otherwise
No, once you fire a function (or a promise), you can't just "reach out to Node event loop and kill it". That's why they added the AbortController.