diff options
author | 2021-03-26 00:09:00 +0000 | |
---|---|---|
committer | 2021-03-26 00:09:00 +0000 | |
commit | 519398bac8cb04ab296e43cc707e466a8a501f12 (patch) | |
tree | ecbca3c040d64bc01c2493ac37746b2ac5035a78 | |
parent | Fix error when converting non claimant message (diff) |
Add 1 second due to POSIX timestamps being lower resolution than datetime objects.
-rw-r--r-- | bot/exts/help_channels/_cog.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py index 46817218f..0e71661ac 100644 --- a/bot/exts/help_channels/_cog.py +++ b/bot/exts/help_channels/_cog.py @@ -2,7 +2,7 @@ import asyncio import logging import random import typing as t -from datetime import datetime +from datetime import datetime, timedelta from operator import attrgetter import discord @@ -295,8 +295,10 @@ class HelpChannels(commands.Cog): log.trace(f"Handling in-use channel #{channel} ({channel.id}).") closing_time, closed_on = await _channel.get_closing_time(channel, self.init_task.done()) - # The time at which the channel should be closed, based on messages sent. - if closing_time < datetime.utcnow(): + + # Closing time is in the past. + # Add 1 second due to POSIX timestamps being lower resolution than datetime objects. + if closing_time < (datetime.utcnow() + timedelta(seconds=1)): log.info( f"#{channel} ({channel.id}) is idle past {closing_time} " |