aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar laundmo <[email protected]>2021-03-20 19:20:17 +0100
committerGravatar laundmo <[email protected]>2021-03-20 19:20:17 +0100
commitcfdff9e9268b599dcc476800df64120b371604a9 (patch)
tree5e813ec10d84dc8b422e98d1a8b600ca40af8383
parentreset cache on bot start, stats for different close reasons (diff)
passing pre-commit
-rw-r--r--bot/exts/help_channels/_channel.py11
-rw-r--r--bot/exts/help_channels/_cog.py4
2 files changed, 11 insertions, 4 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py
index 1e152eaa3..986d3f28b 100644
--- a/bot/exts/help_channels/_channel.py
+++ b/bot/exts/help_channels/_channel.py
@@ -62,12 +62,19 @@ async def get_closing_time(channel: discord.TextChannel) -> t.Tuple[datetime, st
# The further away closing time is what we should use.
if claimant_last_message_time >= non_claimant_last_message_time:
- log.trace(f"#{channel} ({channel.id}) should be closed at {claimant_last_message_time} due to claimant timeout.")
+ log.trace(
+ f"#{channel} ({channel.id}) should be closed at "
+ f"{claimant_last_message_time} due to claimant timeout."
+ )
return claimant_last_message_time, "claimant_timeout"
else:
- log.trace(f"#{channel} ({channel.id}) should be closed at {non_claimant_last_message_time} due to others timeout.")
+ log.trace(
+ f"#{channel} ({channel.id}) should be closed at "
+ f"{non_claimant_last_message_time} due to others timeout."
+ )
return non_claimant_last_message_time, "others_timeout"
+
async def get_in_use_time(channel_id: int) -> t.Optional[timedelta]:
"""Return the duration `channel_id` has been in use. Return None if it's not in use."""
log.trace(f"Calculating in use time for channel {channel_id}.")
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py
index ef6a286d6..1e9332323 100644
--- a/bot/exts/help_channels/_cog.py
+++ b/bot/exts/help_channels/_cog.py
@@ -119,7 +119,7 @@ class HelpChannels(commands.Cog):
await _caches.claim_times.set(message.channel.id, timestamp)
await _caches.claimant_last_message_times.set(message.channel.id, timestamp)
# non_claimant needs to be set too, to satisfy the condition in `_channel.get_closing_time` the first time.
- # Otherwise it will fall back to the old method if no other messages are sent.
+ # Otherwise it will fall back to the old method if no other messages are sent.
await _caches.non_claimant_last_message_times.set(message.channel.id, timestamp)
# Not awaited because it may indefinitely hold the lock while waiting for a channel.
@@ -378,7 +378,7 @@ class HelpChannels(commands.Cog):
_unclaim_channel = decorator(_unclaim_channel)
return await _unclaim_channel(channel, claimant_id, closed_on)
-
+
async def _delete_message_time_caches(self, channel: discord.TextChannel) -> None:
"""Delete message time caches """
await _caches.claimant_last_message_times.delete(channel.id)