You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
There are occasions that we want our general schedulers to have a locking mechanism and instances of scheduler run only one job across all instances for all the defined job except some of them. In other words, let a specific job to be scheduled by all the scheduler across different instances.
The only way I have came to is to implement a custom locker on my side and drop using the locking mechanism of gocron as these methods and functions are not part of the package's public API.
Additional context
I'd be happy to open a PR and address this enhancement.
This feature would allow to run some of our jobs in batch mode by all the instance (and let the job itself decide how they want to divide and conquer if necessary) and some of our jobs only to be run by one instance at each point in time.
The text was updated successfully, but these errors were encountered:
hey @seinshah I think the enhancement seems reasonable. Any of the job options are currently able to be set globally with WithGlobalJobOptions. So, Locker could have been created at the job level originally and then allowed to be set globally. Anyway, that aside, I'm good with having it available at a job level.
Is your feature request related to a problem? Please describe
There are occasions that we want our general schedulers to have a locking mechanism and instances of scheduler run only one job across all instances for all the defined job except some of them. In other words, let a specific job to be scheduled by all the scheduler across different instances.
Describe the solution you'd like
1. Edit WithDistributedJobLocker
gocron/job.go
Lines 552 to 560 in c180381
2. Update
executor.runJob
to respect the abovegocron/executor.go
Lines 373 to 391 in c180381
The last else would be:
Describe alternatives you've considered
The only way I have came to is to implement a custom locker on my side and drop using the locking mechanism of gocron as these methods and functions are not part of the package's public API.
Additional context
I'd be happy to open a PR and address this enhancement.
This feature would allow to run some of our jobs in batch mode by all the instance (and let the job itself decide how they want to divide and conquer if necessary) and some of our jobs only to be run by one instance at each point in time.
The text was updated successfully, but these errors were encountered: