-
-
Notifications
You must be signed in to change notification settings - Fork 309
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] - Runs task twice #52
Comments
@Streppel could you help me here? |
Absolutely, thanks for bringing it out. Will take a look ASAP! |
@pandurang90 just to keep you updated I did some investigations but had to take a field trip this week but I'm back at it now |
Getting the same issue. |
Also getting this |
Looks to be an issue just with the specific days of the week |
@Streppel Any release date? :) Just want to know if I need to switch to another method temporarily or if the fix will be released this week. Thanks! |
@adriendomoison by this weekend or next week for sure! This week I was pretty busy myself but now we're just finishing up with some month scheduling issues that were happening as well, and we'd be good to go. |
We merged a PR that addressed this. Everything looks good from my tests; If you guys could give it a try and report back the result here, that would be greatly appreciated. If needed, we can reopen this. |
Hello, this problem still occurs in my program.
Sometimes, this is my output :
I think I found a way by updating the call to my scheduler :
but it does not resolve the real problem. Thank you ! |
@jrobin42 so it happens only sometimes, not always? |
yes, I did not found a pattern to reproduce this bug, it only happens sometimes |
v1.4.0 is released with a fix. Please let us know if you continue to see this issue occurring. |
Hi, reproduced in such a way
Using for log rotation, to log files were created, instead of one. First 20210426_235959.log
Second 20210427_000000.log
Builded and runned on Win10. Case '6 0 * * *' worked correct. |
Thanks for the info @KnBrBz. We'll investigate more. This bug specifically happened using "0 0 * * *" cron notation, right? |
Yes, for now will use fix suggested by jrobin42. Using notation An update: reproduced once more with notation |
Edit: User error - see below. I'm also having this problem when I do the following: s := gocron.NewScheduler(time.Local)
s.StartAsync()
s.Every(1).Minute().Do(somefunc)
|
@asmaloney could you share a bigger example of the code? Where are you running this? When I run it outputs once per minute on a Mac |
Edit: User error - see below. Hmmm... yeah, this might be tough. I'm using macOS as well, but running this in a docker container based on I've only just started to use gocron, so there isn't any other gocron code executing. Here's the code with the function: func initThis() {
s := gocron.NewScheduler(time.Local)
s.StartAsync()
s.Every(1).Minute().Do(someFunc)
}
func someFunc() {
fmt.Printf("someFunc\n")
} It is running once a minute, but "someFunc" is output twice each time. Not sure if that helps though... Edit: And the version from my go.mod: |
My apologies for the noise! Turns out the thing that was calling User error. 😊 |
@asmaloney all good! I've seen and done that before myself 😞 😂 |
Hi, faced the same bug in my environment (MacOS + docker). After some debugging, I found that |
@artemgavrilov thanks for digging and finding those issues! I’m going to read up because this is a really interesting bug. |
I am also getting this issue. Something like this:
Prints "Doing something" twice. I have confirmed the code to schedule only runs once. |
I added a Dockerfile to golang/go#45582 that reproduces the issue - let's see if we can get some traction on that issue as this appears to be related to Go itself and not our library. |
I spent some time digging into golang/go#27090 and TL;DR, there are two calls to the My thought then is that rather than relying solely on on time.AfterFunc we put in a check to compare the expected next time.Time the job will be run and if time.AfterFunc returns "early" with regard to the wall clock time, we'll be able to catch it. I put together a branch to test this out on. If anyone can test out their code with this branch and see if you still encounter the issue, that would be extremely helpful! https://github.com/go-co-op/gocron/tree/afterfunc-catch |
Hello! We had same issue where our task runs twice(e.g. 11:59 and 12:00) in docker(golang:1.16 with MacOS). |
Hi, this fix solves the problem for us! Thanks! |
This has been released with v1.7.1 |
Hi I have same issue with version v1.18, I am scheduling the job 1 time, but it runs twice. |
Can you provide the code? |
I also have this problem, but only sporadically. Like so:
About one time out of four, so every 20 min approx, it will run twice. Other times it will run only once. |
@dhovang can you share more of your code example? I can't recreate the issue on my side. |
Closing, please re-open if you have an example to share that's generating this issue. I am unable to reproduce. |
Using the latest version currently, I encountered a situation where the execution occurs twice. After multiple tests, I found that the occurrence of execution twice is sporadic, and I am not sure under what circumstances it occurs.
my code:
However, when I switched to a lower version for testing, I found that the execution twice situation did not occur.
|
Hi everyone, I am trying to integrate
gocron
in my service. But when I tried to run task it is running it twice.Is there something that I am missing or is it a bug?
Thanks you very much.
The text was updated successfully, but these errors were encountered: