Answer the question
In order to leave comments, you need to log in
How to stop a running function (task)?
On the server (Node/Express), tasks are running that run at intervals
function testJob (name, timeout) {
setInterval(() => {
console.log(name)
}, timeout)
}
function startUpJobs () {
Job.find({}).then(jobs => {
jobs.forEach(job => {
testJob(job.name, job.timeout)
})
})
}
cron
for Node https://github.com/kelektiv/node-cron there is a way stop()
but I don't understand how to identify the right task?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question