Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Support Multiple Machines with Scheduler #69

Closed
tomschlick opened this issue Apr 25, 2016 · 5 comments
Closed

Support Multiple Machines with Scheduler #69

tomschlick opened this issue Apr 25, 2016 · 5 comments

Comments

@tomschlick
Copy link

Laravel has a great scheduling feature to allow you to manage cron jobs in your codebase, but one of the biggest problem's is when it comes to multiple machines.

Right now if you have 3 application servers behind a load balancer, you are forced to choose one that will initiate these cron jobs. If that server goes down your cron jobs won't execute. This is especially troublesome when you are using something like an auto-scaling group which can initiate / terminate instances at any time.

My proposal is to allow storing the cron's lock file in the cache (redis, memcached, etc) instead of storing it in the file system only.

That would allow you deploy all of your servers with the same cron configuration and the first server to get to a specific cron job would lock the others out and release when they are done. If a server goes down it's no longer a problem as any other server can pick up the slack and execute the cron jobs.

I started a pull request for this back in November but didn't have time to complete it with the limited free time I had. Before creating a new PR, I wanted to see what everyone else thought about this idea or if there were any better ways to accomplish this.

@taylorotwell
Copy link
Member

This has been implemented in 5.4.

@tomschlick
Copy link
Author

❤️

@Lambik
Copy link

Lambik commented Nov 6, 2016

Thanks!

@lbm-trentm
Copy link

Does anyone happen to know whether this was fixed implicitly, or whether you still need to code for it somehow?

@tomschlick
Copy link
Author

@lbm-trentm it should "just work" so long as your cache is set to something shared between the servers

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

No branches or pull requests

4 participants