fix (studybadges): Fix cache refresh on update.

This commit is contained in:
2021-09-27 21:31:44 +03:00
parent f49126ef2b
commit f17a2d839a

View File

@@ -165,6 +165,10 @@ async def cmd_studybadges(ctx, flags):
# Delete the rows # Delete the rows
study_badges.delete_where(badgeid=[row.badgeid for row in to_delete]) 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 # Immediately refresh the member data, only for members with NULL badgeid
update_rows = new_study_badges.select_where( update_rows = new_study_badges.select_where(
guildid=ctx.guild.id, guildid=ctx.guild.id,
@@ -278,7 +282,7 @@ async def cmd_studybadges(ctx, flags):
) )
# Also update the cached guild roles # 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) study_badges.queries.for_guild(ctx.guild.id)
# Ack changes # Ack changes