From ae05ac766d69811a721e7df435e62db7eb15b721 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Tue, 31 Jul 2018 03:42:21 +0000 Subject: [PATCH] Enforce more keys to expire --- discordbot/titanembeds/redisqueue.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/discordbot/titanembeds/redisqueue.py b/discordbot/titanembeds/redisqueue.py index e6a7139..e4d275c 100644 --- a/discordbot/titanembeds/redisqueue.py +++ b/discordbot/titanembeds/redisqueue.py @@ -124,10 +124,11 @@ class RedisQueue: member = self.bot.get_guild(int(params["guild_id"])).get_member(int(params["user_id"])) if not member: await self.connection.set(key, "") + await self.enforce_expiring_key(key) return user = get_formatted_user(member) - await self.enforce_expiring_key(key) await self.connection.set(key, json.dumps(user, separators=(',', ':'))) + await self.enforce_expiring_key(key) async def on_get_guild_member_named(self, key, params): guild = self.bot.get_guild(int(params["guild_id"])) @@ -148,6 +149,7 @@ class RedisQueue: get_guild_member_param = {"guild_id": guild.id, "user_id": result_id} await self.on_get_guild_member(get_guild_member_key, get_guild_member_param) await self.connection.set(key, result) + await self.enforce_expiring_key(key) async def on_list_guild_members(self, key, params): guild = self.bot.get_guild(int(params["guild_id"])) @@ -185,6 +187,7 @@ class RedisQueue: guild = self.bot.get_guild(int(params["guild_id"])) if not guild: await self.connection.set(key, "") + await self.enforce_expiring_key(key) return if guild.me.guild_permissions.manage_webhooks: try: @@ -213,6 +216,7 @@ class RedisQueue: user = self.bot.get_user(int(params["user_id"])) if not user: await self.connection.set(key, "") + await self.enforce_expiring_key(key) return user_formatted = { "id": user.id, @@ -221,4 +225,5 @@ class RedisQueue: "avatar": user.avatar, "bot": user.bot } - await self.connection.set(key, json.dumps(user_formatted, separators=(',', ':'))) \ No newline at end of file + await self.connection.set(key, json.dumps(user_formatted, separators=(',', ':'))) + await self.enforce_expiring_key(key) \ No newline at end of file