Reputation: 6019
A Meteor server code needs to run on the first second of every months "billing system". What would be a light weigh efficient way to go about it?
1)vsivsi:job-collection
2)percolate:synced-cron
Seam to be over kill. Any suggestion? thx
Upvotes: 0
Views: 173
Reputation: 2386
if you're using percolate:synced-cron, then somewhere on the server, you would run code that looks like this.
import {Meteor} from 'meteor/meteor';
Meteor.startup(() => {
SyncedCron.add({
name: 'Do Billing Task',
schedule: function(parser) {
return parser.text('on the first day of the month');
},
job: function() {
DoBillingTask();
}
});
SyncedCron.start();
});
cron itself is lightweight and is suited to the task you describe.
for the text, "on the first day of the month", i picked something that sounds like it would fit your needs. but that parser package has a lot of flexibility, you can read about it here:
http://bunkat.github.io/later/parsers.html#cron
Upvotes: 1