-
Notifications
You must be signed in to change notification settings - Fork 5.7k
The time set in run_daily shifts over weeks #1338
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
Comments
Hey, I now see that we never responded to this issue. We've discussed it internally and this should definitely be fixed. Do you feel up to making a PR for that yourself? |
Hi @Eldinnie .
I would go for the third solution, but I do not know if there could be any kind of job which suffers from such a rule. What do you think? One could also make this rule optional (some kwarg like |
Hi @Eldinnie @jsmnbom @leandrotoledo , |
I think the best solution would be to make each job run on a separate thread, so that even if the job takes longer than its interval to execute, it doesn't block the
I also would think this is the culprit, but then it seems strange it's affecting you, since your job is scheduled for every week. @MarcelBeining can you confirm/deny that your job can take over a week to execute? |
Hi. So, this issue hasn't gotton any attention for a long time but as we're now refactoring the JobQueue to rely on a third party lib, it should be fixed. I actually ran the example provided by @matveyplevako and it works fine as long as you set |
In my bot I have a run_daily job which should execute each Monday night at 0:01 however it runs at some arbitrary time in the afternoon after some weeks. The server clock is correct.
I think this is because even if you set a time point in run_daily, an interval is subsequently calculated by the jobqueue class and if the job's called function takes some time to complete or the job cannot be run immediately as other jobs are running, the job is afterwards put again into the queue but with some shift! This should be fixed, e.g. that the exact time point is stored in the job object and the interval at which it has to be called again is then calculated each time.
Steps to reproduce
Create a function that takes a long time to finish. (30min+)
Put that function into the jobQueue using run_daily and set a specific time point at which it should run each day.
Let it run for some days.
Expected behaviour
The job should run each day at exactly the same time.
Actual behaviour
The time at which the job runs is slowly shifting to later time points.
Configuration
Operating System:
Ubuntu
Version of Python, python-telegram-bot & dependencies:
Python 3.6, python-telegram-bot v11.1.0
The text was updated successfully, but these errors were encountered: