var Queue = require('bull')
var queueName = 'cron-daily'
var q = new Queue(queueName, 'redis://localhost:6379')
var name = "World"
var cnt = 1
var cronExpr = {cron: "*/1 * * * *"}
q.process(function(job) {
console.log("Hello %s %s. JobId: %s", cnt++, name, job.id)
return Promise.resolve("done.")
})
q.add(null, {repeat: cronExpr})
setTimeout(function() {
q.removeRepeatable(queueName, cronExpr).then(function() {
console.log("cron removed")
name = "Manuel"
})
}, 60*1000*3)
Created
May 7, 2018 13:39
-
-
Save sese/651af2fc29cf76c23a1777a1cb982dfa to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment