Skip to content

The time set in run_daily shifts over weeks #1338

@MarcelBeining

Description

@MarcelBeining

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

  1. Create a function that takes a long time to finish. (30min+)

  2. Put that function into the jobQueue using run_daily and set a specific time point at which it should run each day.

  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions