[英]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.