dbader / dbader/schedule

random based on time of day

Open
#472 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
12.3k
Forks
999
PR merge metrics
No merged PRs in 30d

Description

Library already has random for interval, but would be very nice if the time base of at() could also have something that would allow randomizing. It could use the to() function to store the maximum delta time. Example:
schedule.every().day().at('18:00').to(60).do(job)
This would allow for a random time from 18:00 to 19:00. Also, this is simple in that the random delta time would be from 0 to the number provided and then added to the at() time.
Changes would be mostly in the _schedule_next_run method around line 670
Need for the update is to have tv guide data updated around 6:00pm each day before the evening broadcasts, but need to have everyone who uses the app to not request the data from the server at the same time causing possible overload.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the _schedule_next_run method around line 670 and compare how interval randomization is handled. Use the proposed schedule.every().day().at('18:00').to(60).do(job) example as the target behavior: the next run should fall randomly between 18:00 and 19:00, with the documented API and tests updated accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.