簡體   English   中英

使用公牛和 typescript 進行作業調度

[英]Job scheduling using bull and typescript

我正在嘗試使用Bull進行一些調度。 這是我的代碼

const avqueue = new Bull('avque');

avqueue.add({ video: '' }, { repeat: { cron: '*/50 * * * * *' }} );

avqueue.process( function(job, done) {
  console.log('avqueue');
  done();
});

但它每毫秒執行一次。如果我錯過任何參數或某些東西,請告訴我。

您在 cron 配置上犯了一個錯誤。

cron: '*/50 * * * * *'無效配置


cron 配置僅支持 5 個元素,而不支持 6 個元素。

正確的配置是

cron: '*/50 * * * *'

在本公牛指南中,您可以看到以下示例:

// 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM