From ef6ea2fb05c4cbb987494de1f1a37e213aeffc51 Mon Sep 17 00:00:00 2001 From: SebastiaanZ <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 15 Apr 2019 08:48:23 +0200 Subject: Cleaning up the fix by removing unnecessary initial None and None check --- bot/cogs/off_topic_names.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bot/cogs/off_topic_names.py b/bot/cogs/off_topic_names.py index 44d31464f..99dc725d2 100644 --- a/bot/cogs/off_topic_names.py +++ b/bot/cogs/off_topic_names.py @@ -50,11 +50,8 @@ async def update_names(bot: Bot, headers: dict): # To ensure we only cycle once per day, we increase the reference midnight point # by one day each time the task runs instead of relying on "the most recent" # midnight, since that may fail if the task is triggered early. - midnight = None + midnight = midnight = datetime.utcnow().replace(microsecond=0, second=0, minute=0, hour=0) while True: - if midnight is None: - midnight = datetime.utcnow().replace(microsecond=0, second=0, minute=0, hour=0) - midnight += timedelta(days=1) seconds_to_sleep = (midnight - datetime.utcnow()).seconds log.debug(f"update_names: seconds to sleep {seconds_to_sleep}") -- cgit v1.2.3