aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2020-06-06 12:33:06 +0200
committerGravatar Leon Sandøy <[email protected]>2020-06-06 12:33:06 +0200
commit94f096fab3bde10ba0da767c568c7a8c3ff3259f (patch)
treef98ed5ccb537688516859fa6fa0a32affe9a3c60
parentStore booleans as integers instead of strings. (diff)
Store epoch timestamps instead of strings.
We're also switching from datetime.now() to datetime.utcnow().
-rw-r--r--bot/cogs/help_channels.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py
index 8c01e5dc4..dd3e3cb8b 100644
--- a/bot/cogs/help_channels.py
+++ b/bot/cogs/help_channels.py
@@ -9,7 +9,6 @@ from contextlib import suppress
from datetime import datetime
from pathlib import Path
-import dateutil
import discord
import discord.abc
from discord.ext import commands
@@ -550,9 +549,9 @@ class HelpChannels(Scheduler, commands.Cog):
self.bot.stats.incr(f"help.dormant_calls.{caller}")
if await self.claim_times.contains(channel.id):
- claimed_datestring = await self.claim_times.get(channel.id)
- claimed = dateutil.parser.parse(claimed_datestring)
- in_use_time = datetime.now() - claimed
+ claimed_timestamp = await self.claim_times.get(channel.id)
+ claimed = datetime.fromtimestamp(claimed_timestamp)
+ in_use_time = datetime.utcnow() - claimed
self.bot.stats.timing("help.in_use_time", in_use_time)
if await self.unanswered.contains(channel.id):
@@ -688,7 +687,7 @@ class HelpChannels(Scheduler, commands.Cog):
self.bot.stats.incr("help.claimed")
- await self.claim_times.set(channel.id, str(datetime.now()))
+ await self.claim_times.set(channel.id, datetime.utcnow().timestamp())
await self.unanswered.set(channel.id, True)
log.trace(f"Releasing on_message lock for {message.id}.")