[英]Job scheduling using bull and typescript
I am trying to do some scheduling using bull .我正在尝试使用Bull进行一些调度。 Here is my code
这是我的代码
const avqueue = new Bull('avque');
avqueue.add({ video: '' }, { repeat: { cron: '*/50 * * * * *' }} );
avqueue.process( function(job, done) {
console.log('avqueue');
done();
});
But it is getting executed in every milliseconds.Please let me know if I miss any param or someting.但它每毫秒执行一次。如果我错过任何参数或某些东西,请告诉我。
You did a mistake on the cron configuration.您在 cron 配置上犯了一个错误。
cron: '*/50 * * * * *'
is an invalid configuration cron: '*/50 * * * * *'
是无效配置
The cron configuration only support 5 elements and not 6. cron 配置仅支持 5 个元素,而不支持 6 个元素。
The correct configuration is :正确的配置是:
cron: '*/50 * * * *'
In this bull guide you can see the following example:在本公牛指南中,您可以看到以下示例:
// Repeat every 10 seconds for 100 times.
const myJob = await myqueue.add(
{ foo: 'bar' },
{
repeat: {
every: 10000,
limit: 100
}
}
);
// Repeat payment job once every day at 3:15 (am)
paymentsQueue.add(paymentsData, { repeat: { cron: '15 3 * * *' } });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.