Open rocky4546 opened 3 years ago
i will try to do it
Would this be outside the scope of the library? The string necessary to accomplish this can easily be built with
from random import randint
go_time = f'18:{randint(0,59):02}'
That string can then be fed into schedule.
schedule.every().day().at(go_time).do(job)
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.