aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-09-24 19:25:30 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-09-24 19:25:30 +0200
commitf2381f8355fbc54a292506a9cbf7b97928f6c421 (patch)
treecad08b50e0129d81797429a05cd1ec00d8928721
parentPut import in alphabetical order (diff)
Remove repeat logic for off-topic-name api call
After a short discussion in the core-dev team, we decided to not use retry logic for a failed API call for new off-topic-names. We may introduce something similar in the future, but we're not sure on the direction we want to take yet.
-rw-r--r--bot/cogs/off_topic_names.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/bot/cogs/off_topic_names.py b/bot/cogs/off_topic_names.py
index 618f9b927..16717d523 100644
--- a/bot/cogs/off_topic_names.py
+++ b/bot/cogs/off_topic_names.py
@@ -42,15 +42,13 @@ class OffTopicName(Converter):
async def update_names(bot: Bot) -> None:
"""Background updater task that performs the daily channel name update."""
- skip_sleep = False
while True:
# Since we truncate the compute timedelta to seconds, we add one second to ensure
# we go past midnight in the `seconds_to_sleep` set below.
today_at_midnight = datetime.utcnow().replace(microsecond=0, second=0, minute=0, hour=0)
next_midnight = today_at_midnight + timedelta(days=1)
seconds_to_sleep = (next_midnight - datetime.utcnow()).seconds + 1
- if skip_sleep is False:
- await asyncio.sleep(seconds_to_sleep)
+ await asyncio.sleep(seconds_to_sleep)
try:
channel_0_name, channel_1_name, channel_2_name = await bot.api_client.get(
@@ -58,8 +56,6 @@ async def update_names(bot: Bot) -> None:
)
except ResponseCodeError as e:
log.error(f"Failed to get new off topic channel names: code {e.response.status}")
- skip_sleep = True
- await asyncio.sleep(1800)
continue
channel_0, channel_1, channel_2 = (bot.get_channel(channel_id) for channel_id in CHANNELS)
@@ -70,7 +66,6 @@ async def update_names(bot: Bot) -> None:
"Updated off-topic channel names to"
f" {channel_0_name}, {channel_1_name} and {channel_2_name}"
)
- skip_sleep = False
class OffTopicNames(Cog):