From f17a2d839a1a23123eff5ca0200c556be6f0b49d Mon Sep 17 00:00:00 2001 From: Conatum Date: Mon, 27 Sep 2021 21:31:44 +0300 Subject: [PATCH] fix (studybadges): Fix cache refresh on update. --- bot/modules/study/studybadge_cmd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot/modules/study/studybadge_cmd.py b/bot/modules/study/studybadge_cmd.py index 5f532bfe..7fe004aa 100644 --- a/bot/modules/study/studybadge_cmd.py +++ b/bot/modules/study/studybadge_cmd.py @@ -165,6 +165,10 @@ async def cmd_studybadges(ctx, flags): # Delete the rows study_badges.delete_where(badgeid=[row.badgeid for row in to_delete]) + # Also update the cached guild roles + guild_role_cache.pop((ctx.guild.id, ), None) + study_badges.queries.for_guild(ctx.guild.id) + # Immediately refresh the member data, only for members with NULL badgeid update_rows = new_study_badges.select_where( guildid=ctx.guild.id, @@ -278,7 +282,7 @@ async def cmd_studybadges(ctx, flags): ) # Also update the cached guild roles - guild_role_cache.pop(ctx.guild.id, None) + guild_role_cache.pop((ctx.guild.id, ), None) study_badges.queries.for_guild(ctx.guild.id) # Ack changes