301: This package is moved to the main repository of NPM version, but still can be installed via Atmosphere as Meteor package!
meteor add ostrio:cron-jobs
Looking for NPM version? - Go to JoSk package
import { CRONjob } from 'meteor/ostrio:cron-jobs';
Error: Can't wait without a fiber
Can be easily solved via "bounding to Fiber":
const bound = Meteor.bindEnvironment((callback) => {
callback();
});
const db = Collection.rawDatabase();
const cron = new CRONjob({db: db});
const task = (ready) => {
bound(() => {
ready();
});
};
cron.setInterval(task, 60 * 60 * 1000, 'task');