firstandthird / hapi-job-queue

Hapi and MongoDB powered job queue.
MIT License
3 stars 1 forks source link

Db sync #3

Open dawnerd opened 9 years ago

dawnerd commented 9 years ago

If running on multiple servers it's possible that the job list can get out of sync if calls to enable/disable/reschedule are made. Could use an option to sync up the db every x minutes, or maybe sync on job runs?

Workaround right now is to call getJobs which pulls from the db and modify the local jobs array to match.

jgallen23 commented 9 years ago

Syncing scares me.

dawnerd commented 9 years ago

Yeah. I'm not sure if it's really needed. Agenda checks the db every x seconds which kind of acts like a sync. Here the db is only checked when a job is run.

jgallen23 commented 9 years ago

I think the current server should get job from db on run and see if anything has changed before actually running

dawnerd commented 9 years ago

That's a good idea, and wouldn't be that hard to implement since the db is already hit when a job runs to make sure it's not locked.