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
In run_scheduler_loop function in next_minute calculation if datetime.now() = 17:22:59.55555 and we replace seconds and microseconds with 0 and add timedelta(minutes=1) we get next_minute=17:23:00
and when we calculate delay with delay = next_minute - datetime.now(), current time can be > or just a bit lower than next_minute, so we get negative delay like -0.000299 or positive like 0.000373
I checked the current main branch and this looks already fixed.
The original problem was caused by minute-boundary timing in the old scheduler loop, but that logic was changed in bfcc7d2 (Avoid duplication of task execution). The scheduler was later refactored further, so I do not see an active bug to fix here now.
But a regression test for the original boundary case could still be useful.
Activity
s3rius commentedon Apr 19, 2024
Actually you're right, but I think it can be resolved by calculating next_minute right after sending all tasks.
In this setup it would be impossible to get into the situation with negative number of seconds. What do you think?
taras0024 commentedon Sep 6, 2024
Hello
I have the same problem with sending scheduled task twice. Are there any solutions to resolve this problem?
s3rius commentedon Sep 6, 2024
What version of taskiq are you on? And can you please give some information what is happening?
taras0024 commentedon Sep 6, 2024
taskiq==0.11.7
tasks file (main.py)
scheduler file (schedule.py)
taskiq runner fork file with added prints (lib.py)
Results

Atanusaha143 commentedon Nov 28, 2024
@s3rius Can you please look into this discussion?
sescer commentedon Jul 28, 2026
I checked the current
mainbranch and this looks already fixed.The original problem was caused by minute-boundary timing in the old scheduler loop, but that logic was changed in
bfcc7d2(Avoid duplication of task execution). The scheduler was later refactored further, so I do not see an active bug to fix here now.But a regression test for the original boundary case could still be useful.
danfimov commentedon Sep 16, 2026
Double-checked, issue already solved, so I will close it)