Skip to content

Commit

Permalink
Spread schedule partial fix for #366 (#385)
Browse files Browse the repository at this point in the history
* job scheduling on seconds instead of minutes #366

* fixed linelength and spaces around operator

Co-authored-by: jochemthart1 <jchmthrt@gmail.com>
  • Loading branch information
jochemthart1 and JukeofHolland committed Aug 30, 2021
1 parent f85715e commit 671c038
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion GeoHealthCheck/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ def update_job(resource):
def add_job(resource):
LOGGER.info('Starting job for resource=%d' % resource.identifier)
freq = resource.run_frequency
next_run_time = datetime.now() + timedelta(minutes=random.randint(0, freq))
next_run_time = datetime.now() + timedelta(
seconds=random.randint(0, freq * 60))
scheduler.add_job(
run_job, 'interval', args=[resource.identifier, freq],
minutes=freq, next_run_time=next_run_time, max_instances=1,
Expand Down

0 comments on commit 671c038

Please sign in to comment.