Skip to content

Commit

Permalink
parametrised running after MORPH_RUN_AFTER_HOUR hour
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhyatt committed Oct 9, 2017
1 parent 4c6bfae commit 918c7f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scraper.py
Expand Up @@ -23,10 +23,11 @@
print "Runs on weekend, bailing..."
exit(0)

# Sleep until after 22:00
# Sleep until after RUNHOUR
after_hour = int(os.environ['MORPH_RUN_AFTER_HOUR'])
hour = int(now.strftime("%H"))
if 22 > hour:
time.sleep((22 - hour) * 60 * 60)
if after_hour > hour:
time.sleep((after_hour - hour) * 60 * 60)

TO_DATE = now
TO_DATE -= relativedelta.relativedelta(days=int(os.environ['MORPH_DAYS_OFFSET']))
Expand Down

0 comments on commit 918c7f2

Please sign in to comment.