Crons running at inconsistent times on prod environment; how to manage crons?


#1

I have a pretty basic data structure that looks as follows in user settings.

{
  "reminders": {
    "enabled": true,
    "times": [
       { name: 'breakfast', ms: 28800000 },
       { name: 'dinner', ms: 72000000 }
     ]
  }
}

The ms field refers to the number of milliseconds since the start of the day. I want to match this and perform some action when it happens, so I use SyncedCron to perform it.

SyncedCron.add({
  name: 'send reminders',
  schedule(parser) {
    return { schedules: Meteor.settings.public.reminders }
  },
  job() {
    Promise.map(getUsersToRemind(), user => {
      // do something
    });
  }
});

Meteor.startup(function () {
  SyncedCron.start();
});

However, it appears to run at completely erratic times, why would this happen?