diff --git a/payphone/cogs/mods/cog.py b/payphone/cogs/mods/cog.py index effc62b..e7aff61 100644 --- a/payphone/cogs/mods/cog.py +++ b/payphone/cogs/mods/cog.py @@ -294,12 +294,18 @@ class Mods(base.Cog): "⚡ Notified all channels of calls hang up. Flushing messages to the DB..." ) + await redis.delete(constants.CHANNELS_ONCALL_SET) + calls = await models.Call.filter(ended_at=None) call_ids = [call.id for call in calls] if call_ids: await redis.sadd(constants.CALL_IDS_TO_FLUSH, *call_ids) + await models.Call.filter(ended_at=None).update( + ended_at=datetime.now(timezone.utc) + ) + await self.bot.get_cog("Calls").flush_messages(True) await tortoise.Tortoise.close_connections()