mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat: store shard status in Redis
This commit is contained in:
parent
22faa47d00
commit
0419ced0d2
18 changed files with 602 additions and 183 deletions
|
|
@ -9,30 +9,6 @@ namespace PluralKit.API;
|
|||
|
||||
public static class APIJsonExt
|
||||
{
|
||||
public static JArray ToJSON(this IEnumerable<PKShardInfo> shards)
|
||||
{
|
||||
var o = new JArray();
|
||||
|
||||
foreach (var shard in shards)
|
||||
{
|
||||
var s = new JObject();
|
||||
s.Add("id", shard.Id);
|
||||
|
||||
if (shard.Status == PKShardInfo.ShardStatus.Down)
|
||||
s.Add("status", "down");
|
||||
else
|
||||
s.Add("status", "up");
|
||||
|
||||
s.Add("ping", shard.Ping);
|
||||
s.Add("last_heartbeat", shard.LastHeartbeat.ToString());
|
||||
s.Add("last_connection", shard.LastConnection.ToString());
|
||||
|
||||
o.Add(s);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
public static JObject ToJson(this ModelRepository.Counts counts)
|
||||
{
|
||||
var o = new JObject();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue