Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synced-cron should store scheduled events #80

Open
Szayet opened this issue Mar 1, 2016 · 3 comments
Open

synced-cron should store scheduled events #80

Szayet opened this issue Mar 1, 2016 · 3 comments

Comments

@Szayet
Copy link

Szayet commented Mar 1, 2016

Scheduled, event's should be saved (for cases when the server restarts, like hot-code pushes).

Upon SynchedCron.start() they should 're-schedule' automaticly.

@JKirchartz
Copy link

JKirchartz commented May 28, 2016

+1, I'm new to meteor and I thought I was doing something wrong until I discovered this issue.

Currently, I'm getting around this by creating a function to run the task and a Mongo collection to store events and reschedule them like so:

Meteor.startup(() => {
  // code to run on server at startup
  savedTasks.find({}).forEach((task) => {
    SyncedCron.add({
      name: [task.name, 'for', task.user_id].join(' '),
      schedule: function(parser) {
        return parser.text(task.schedule);
      },
      job: function() {
        return Meteor.call(task.name, { user_id: task.user_id });
      }
    });
  });
  SyncedCron.start();
});

@nick-gudumac
Copy link

+1, this is a pretty big issue.

@tomtom87
Copy link
Collaborator

+1

@JKirchartz great solution, I wonder how we could make that work as a built-in feature...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants