- small clean up
This commit is contained in:
mcinj 2022-05-16 16:03:12 -04:00
parent b51712cb87
commit 6cb493eba7
7 changed files with 29 additions and 21 deletions

View file

@ -1,8 +1,12 @@
import datetime
import threading
from datetime import timedelta, datetime
from random import randint
from threading import Thread
from time import sleep
from dateutil import tz
import log
from enter_giveaways import EnterGiveaways
@ -52,7 +56,9 @@ class GiveawayThread(threading.Thread):
logger.info("🔴 All giveaways evaluated.")
random_seconds = randint(1740, 3540) # sometime between 29-59 minutes
logger.info(f"🛋 Going to sleep for {random_seconds / 60} minutes.")
when_to_start_again = datetime.now(tz=tz.tzlocal()) + timedelta(seconds=random_seconds)
logger.info(f"🛋 Going to sleep for {random_seconds / 60} minutes. "
f"Will start again at {when_to_start_again}")
sleep(random_seconds)
def run(self):
@ -69,4 +75,4 @@ class GiveawayThread(threading.Thread):
# we re-raise the caught exception
# if any was caught
if self.exc:
raise self.exc
raise self.exc