我正在尝试在特定日期安排一次性工作,但是,一旦到达日期,回调就不会被调用。作业被创建并添加到集合中。不知道我做错了什么。使用议程
const agenda = new Agenda({
db: {address: '...', collection: 'agendaJobs'},
useUnifiedTopology: true
});
agenda.on('ready', async () => {
agenda.define("hello",
{ priority: "high", concurrency: 20 },
async (job) => {
console.log("hello");
});
});
async function start() {
agenda.processEvery('1 second');
await agenda.start();
await agenda.schedule("in 10 seconds", "hello");
}
start();