mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 06:17:55 +00:00
fix: don't require Redis for startup
This commit is contained in:
parent
8964d7f623
commit
fc8f1b7cd3
4 changed files with 22 additions and 11 deletions
|
|
@ -37,6 +37,8 @@ public class ShardInfoService
|
|||
|
||||
public async Task<IEnumerable<ShardState>> GetShards()
|
||||
{
|
||||
if (_redis.Connection == null)
|
||||
return new ShardState[] { };
|
||||
var db = _redis.Connection.GetDatabase();
|
||||
var redisInfo = await db.HashGetAllAsync("pluralkit:shardstatus");
|
||||
return redisInfo.Select(x => Proto.Unmarshal<ShardState>(x.Value));
|
||||
|
|
@ -48,6 +50,12 @@ public class ShardInfoService
|
|||
|
||||
async Task Inner()
|
||||
{
|
||||
if (_redis.Connection == null)
|
||||
{
|
||||
_logger.Warning("Redis is disabled, shard connection status will be unavailable.");
|
||||
return;
|
||||
}
|
||||
|
||||
var db = _redis.Connection.GetDatabase();
|
||||
var redisInfo = await db.HashGetAsync("pluralkit::shardstatus", shard.ShardId);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue