Synced-Cron not working on Digital Ocean

Hello everyone,

I have implemented synced-cron to do a task at a certain time in the future that is chosen by the user, for example, post a new message on September 25th at 12:20 pm. Everything worked as I had hoped when I was testing on my local machine but once I uploaded the application to Digital Ocean to test it out, the tasks associated with synced-cron just never executed. I am running my application on the 1 GB droplet on Digital Ocean.

I am able to set a task and delete it but when the time comes to execute the task, it just doesn’t happen.

What could be causing this issue? Is the Digital Ocean server not able to handle this?

Thanks for your help in advance!

I have lots of Synced-Cron jobs working on digitalocean, please provide some sample code.

So, in Meteor.start on the server side, I have SyncedCron.start();

And when the user schedules a task on the client side, the following Meteor method is run:

addTask: function(id, text, currentUser, time){
  		name: id,
  		schedule: function(parser) {
  			return parser.recur().on(new Date(time)).fullDate();
  		job: function() {"postScheduledTask", text, currentUser);
  	        	return id;
postScheduledTask: function(text, userId){
    console.dir("Posting Scheduled Task");

and that’s about it. This works on the local machine but not on Digital Ocean. Do I need to change something for it to work on Digital Ocean?

I’ve never run into this particular issue, but we did have some odd stuff going on with scheduling in one time zone (PST) when the DO server was in another time zone (EST)…ended up storing things in utc.

The time zone could be the problem. The local time on my droplet is Toronto but the universal time is of course ahead of Toronto time. Should I change everything in my application to UTC time or change the global timezone to Toronto time on Digital Ocean?

Well, first I’d probably set up some crons to run at the offset time, so that you can confirm that the time zone is the problem. Then maybe think about a strategy for times. Moment.js and Moment Timezone are definitely helpful in universalizing your times.

1 Like

I was going to just repeat what everyone else here has said. I’ve run apps on DO with Syncd Cron and it worked fine but I needed to make sure the droplet was set to the right timezone.

Thank you everyone for all of your solutions! Turns out, it is a timezone issue. I scheduled a task based on UTC and it worked perfectly. So, I will work on aligning the client time with the UTC time.