From 3e1f09f7cffe2a618df6472a1e8888b834fbfbcf Mon Sep 17 00:00:00 2001 From: skelmis Date: Sun, 17 Dec 2023 16:28:51 +1300 Subject: [PATCH] feat: update to handle new clustering setup --- suggestions/cogs/help_guild_cog.py | 22 ++++++++++++++++------ suggestions/main.py | 2 +- suggestions/zonis_routes.py | 9 --------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/suggestions/cogs/help_guild_cog.py b/suggestions/cogs/help_guild_cog.py index 4b1d602..55f210e 100644 --- a/suggestions/cogs/help_guild_cog.py +++ b/suggestions/cogs/help_guild_cog.py @@ -76,16 +76,26 @@ async def instance_info( shard_id = self.bot.get_shard_id(guild_id) cluster_id = ( 1 - if shard_id < 10 + if shard_id < 5 else 2 - if shard_id < 20 + if shard_id < 10 else 3 - if shard_id < 30 + if shard_id < 15 else 4 - if shard_id < 40 + if shard_id < 20 else 5 - if shard_id < 50 + if shard_id < 25 else 6 + if shard_id < 30 + else 7 + if shard_id < 35 + else 8 + if shard_id < 40 + else 9 + if shard_id < 45 + else 10 + if shard_id < 50 + else 11 ) await interaction.send( @@ -154,7 +164,7 @@ async def show_bot_status( title="Bot infrastructure status", ) down_shards: list[str] = [str(i) for i in range(53)] - down_clusters: list[str] = [str(i) for i in range(1, 7)] + down_clusters: list[str] = [str(i) for i in range(1, 12)] avg_bot_latency: list[float] = [] async with aiohttp.ClientSession( headers={"X-API-KEY": os.environ["GARVEN_API_KEY"]} diff --git a/suggestions/main.py b/suggestions/main.py index f1d6074..602c79c 100644 --- a/suggestions/main.py +++ b/suggestions/main.py @@ -29,7 +29,7 @@ async def create_bot(database_wrapper=None) -> SuggestionsBot: total_shards = 53 cluster_id = int(os.environ["CLUSTER"]) offset = cluster_id - 1 - number_of_shards_per_cluster = 10 + number_of_shards_per_cluster = 5 shard_ids = [ i for i in range( diff --git a/suggestions/zonis_routes.py b/suggestions/zonis_routes.py index 5cbf873..12d4f5f 100644 --- a/suggestions/zonis_routes.py +++ b/suggestions/zonis_routes.py @@ -79,12 +79,3 @@ async def share_with_devs(self, title, description, sender): ) embed.set_footer(text=f"Sender: {sender}") await channel.send(embed=embed) - - @client.route() - async def refresh_premium(self, user_id: int): - # TODO Implement the ability to refresh premium states for a user - return True - - @client.route() - async def shared_guilds(self, guild_ids: list[int]): - return [gid for gid in guild_ids if gid in self.bot.guild_ids]