aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar SebastiaanZ <[email protected]>2019-04-15 08:48:23 +0200
committerGravatar SebastiaanZ <[email protected]>2019-04-15 08:48:23 +0200
commitef6ea2fb05c4cbb987494de1f1a37e213aeffc51 (patch)
treed5caf34a197104cc6fdfa01c1decf7220ebb66f6
parentChanging the way the bug is handled, by courtesy of Mark (diff)
Cleaning up the fix by removing unnecessary initial None and None check
Diffstat (limited to '')
-rw-r--r--bot/cogs/off_topic_names.py5
1 files changed, 1 insertions, 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}")