fix: include shard_id in redis channel

This commit is contained in:
spiral
2022-05-10 07:32:14 -04:00
parent abb01aaf2c
commit 799279054d
4 changed files with 23 additions and 15 deletions

View File

@@ -79,11 +79,7 @@ public class Init
// Start the Discord shards themselves (handlers already set up)
logger.Information("Connecting to Discord");
if (config.RedisGatewayUrl != null)
await services.Resolve<RedisGatewayService>().Start();
else
await StartCluster(services);
await StartCluster(services);
logger.Information("Connected! All is good (probably).");
@@ -189,7 +185,15 @@ public class Init
var shardMin = (int)Math.Round(totalShards * (float)nodeIndex / totalNodes);
var shardMax = (int)Math.Round(totalShards * (float)(nodeIndex + 1) / totalNodes) - 1;
await cluster.Start(info.Url, shardMin, shardMax, totalShards, info.SessionStartLimit.MaxConcurrency, redis.Connection);
if (config.RedisGatewayUrl != null)
{
var shardService = services.Resolve<RedisGatewayService>();
for (var i = shardMin; i <= shardMax; i++)
await shardService.Start(i);
}
else
await cluster.Start(info.Url, shardMin, shardMax, totalShards, info.SessionStartLimit.MaxConcurrency, redis.Connection);
}
else
{