我正在尝试保留所有发生的工作,但是它只是更新了现有的工作。因此,例如,如果调度程序运行了5次,我将仅获得有关上次运行的作业的信息。
const connectionOpts = {
db: {
address: "localhost:27017/scheduler",
collection: "jobsForEmail"
}
};
const agenda = new Agenda(connectionOpts);
let i = 1;
agenda.define("print", (job, done) => {
console.log("printujem ", i++);
done();
});
new Promise(resolve => agenda.once("ready", resolve));
agenda.on("ready", function() {
agenda.start();
agenda.every("*/1 * * * *", "print", { i: i }, { timezone: "UTC" });
});
谢谢