feat(bot): also cluster gateway cache on .internal

This commit is contained in:
alyssa 2024-11-08 10:26:15 +09:00
parent e6c4b4416e
commit 7c913c7b15

View file

@ -48,7 +48,8 @@ public class HttpDiscordCache: IDiscordCache
private async Task<T?> QueryCache<T>(string endpoint, ulong guildId) private async Task<T?> QueryCache<T>(string endpoint, ulong guildId)
{ {
var cluster = _cacheEndpoint.Authority; var cluster = _cacheEndpoint.Authority;
if (cluster.Contains(".service.consul")) // todo: there should not be infra-specific code here
if (cluster.Contains(".service.consul") || cluster.Contains("process.pluralkit-gateway.internal"))
// int(((guild_id >> 22) % shard_count) / 16) // int(((guild_id >> 22) % shard_count) / 16)
cluster = $"cluster{(int)(((guildId >> 22) % (ulong)_shardCount) / 16)}.{cluster}"; cluster = $"cluster{(int)(((guildId >> 22) % (ulong)_shardCount) / 16)}.{cluster}";