-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
[FEATURE] - Run a scheduled a job once in a distributed system #181
Comments
Definitely something we’re interested in supporting |
I like the way that this platform (https://benthos.dev/) abstracts different data sources and I think it would be ideal to then add a reasonable interface to gocron that we could then support multiple specific implementations like redis, ec2, etc. |
The original version had |
@ianaz it never worked properly so we removed it. That’d be a good place to start, adding a locker interface. |
When in a cluster environment, nodes in cluster will be known. Maybe consistenthash may be usable here to detect which node will run which jobs. |
Hi guys, I have a similar situation where I am using gocron to send out a status email once a week. |
I wonder if the approach here could maybe be similar to APScheduler begin with OOTB persistent stores supported like Redis/Postgres - once an interface can be reasonably standardized on, allow people to pass in their own implementations that satisfy it and the core would have to handle queues/locks, moving onto next available etc... I realize the current gocron kind of gives everyone the ability to roll their own version of the above but would be nice to provide that as a built-in option. |
Hello, does this feature supported ? I'm looking for job with shedlock for distritbuted system. I think if this included in this lib is better than Implement in my own project |
Hi, I am also interested in this |
If anyone is able to test out the feature I have in the works that would be great! v1.24.0-rc2 |
I've released distributed locker support with redis and marked it as in beta. Please test and provide feedback when you have a chance! |
Maybe this is not the place, but this is a locker I created and could be used as an example/inspiration for someone else with the same needs: |
Is your feature request related to a problem? Please describe
Currently If I use this package on any cluster of AWS ec2s, all my machines running production code would also run code in the scheduler. For instance if I need a background go routine to scan data every minute and I have 5 machines deployed. I don't need or want all my machines to scan the same data. It's also not cost effective to spin a single isolated ec2 to run a single job.
Describe the solution you'd like
I would like if gocron had to ability to add connections to persistent storage via some sort of interface to allow users to plugin any persistent storage (redis, memcache, sql, etc) such that it kept track of the jobs running. If a job is running by 1 machine and you've set the settings to allow only 1 job globally to run, then all other machines do not run the same job. In essence it would be safe to deploy code on a fleet of web servers and have only 1 web server at any given time run the same job.
some considerations:
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: