-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
[BUG] - Out of sync, multiple executions of same task #174
Comments
Thanks for the detailed report, @alexandre-dias-cj! We will take a look at it! |
@alexandre-dias-cj how are you running this? local machine, docker, etc. |
Docker, forgot to mention it |
hey @alexandre-dias-cj some time is freeing up and I'm getting back to looking at these bugs. Could you help me understand a little bit more about this example, it looks to me like your jobs are essentially recursively calling the function that stops and starts the scheduler? It's hard for me to dig into to exactly what is happening here because this isn't really using the scheduler as it was designed. I would propose right off the bat that, that we redesign your functions to not be starting and stopping the scheduler and instead leave the scheduler running. For example: scheduler := gocron.NewScheduler(time.Local)
scheduler.Every(30).Seconds().Tag(partialUpdatesTag...).SingletonMode().Do(runPartialReindex)
func runPartialReindex() {
log.Println("Runing partial...")
indexSomeData() //dummy function won't take more than 200ms to complete
} That's maybe simplistic and I'm probably missing something in the reasoning behind your implementation. Help me understand and we can work more on what might be happening! |
Sure, we actually had 3 schedulers running, there are 2 different functions which interact with one single data repository. We did actually ended up rebuilding our service to get rid of the problem. |
When using a 30s interval scheduler, after a few hours it runs multiple times the same task, per second
Example snippet
It wasn't expected that the runPartialReindex function was run more than once per 30s interval
I did try with partialIndexer.Every(30).Second() and partialIndexer.Every(30).Seconds() but the described problem is even worse
Not sure if it matters but I'm using go mod.
The text was updated successfully, but these errors were encountered: