[英]Get the iteration position in repeatable jobs in bulljs
例如,我想在可重复作业回调中的某个 position 中执行一些操作
const Bull = require('bull');
const queue = new Bull('payment');
// should repeat this task every 5 minutes , 24 times
queue.add('trackPayment' , anyData , {
repeat : {
every : 300000,
limit : 24,
}
});
queue.process('trackPayment' , async (data) => {
// this job have a limit of 24 iterations
// would like to do some action in the iteration #24
/*
if (data.iteration == 24) doAction();
*/
})
queue.process("handle", function (data) {
console.log(data.opts.repeat.count)
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.