mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-11-03 16:24:27 -05:00
- NadekoBot class renamed to Bot
- Implemented grpc based coordinator. Supports restarting, killing single or all shards, as well as getting current shard statuses. (Adaptation of the one used by the public bot) - Coord is setup via coord.yml file - Methods from SelfService which deal with shard/bot restart etc have been moved to ICoordinator (with GrpcRemoteCoordinator being the default implementation atm) - Vastly simplified NadekoBot/Program.cs
This commit is contained in:
21
src/NadekoBot.Coordinator/Shared/Config.cs
Normal file
21
src/NadekoBot.Coordinator/Shared/Config.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace NadekoBot.Coordinator
|
||||
{
|
||||
public readonly struct Config
|
||||
{
|
||||
public int TotalShards { get; init; }
|
||||
public int RecheckIntervalMs { get; init; }
|
||||
public string ShardStartCommand { get; init; }
|
||||
public string ShardStartArgs { get; init; }
|
||||
public double UnresponsiveSec { get; init; }
|
||||
|
||||
public Config(int totalShards, int recheckIntervalMs, string shardStartCommand, string shardStartArgs, double unresponsiveSec)
|
||||
{
|
||||
TotalShards = totalShards;
|
||||
RecheckIntervalMs = recheckIntervalMs;
|
||||
ShardStartCommand = shardStartCommand;
|
||||
ShardStartArgs = shardStartArgs;
|
||||
UnresponsiveSec = unresponsiveSec;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
9
src/NadekoBot.Coordinator/Shared/CoordState.cs
Normal file
9
src/NadekoBot.Coordinator/Shared/CoordState.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Coordinator
|
||||
{
|
||||
public class CoordState
|
||||
{
|
||||
public List<JsonStatusObject> StatusObjects { get; init; }
|
||||
}
|
||||
}
|
||||
11
src/NadekoBot.Coordinator/Shared/JsonStatusObject.cs
Normal file
11
src/NadekoBot.Coordinator/Shared/JsonStatusObject.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace NadekoBot.Coordinator
|
||||
{
|
||||
public class JsonStatusObject
|
||||
{
|
||||
public int? Pid { get; init; }
|
||||
public int GuildCount { get; init; }
|
||||
public ConnState ConnectionState { get; init; }
|
||||
}
|
||||
}
|
||||
15
src/NadekoBot.Coordinator/Shared/ShardStatus.cs
Normal file
15
src/NadekoBot.Coordinator/Shared/ShardStatus.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace NadekoBot.Coordinator
|
||||
{
|
||||
public sealed record ShardStatus(
|
||||
int ShardId,
|
||||
DateTime LastUpdate,
|
||||
int GuildCount = 0,
|
||||
ConnState State = ConnState.Disconnected,
|
||||
bool ShouldRestart = false,
|
||||
Process Process = null,
|
||||
int StateCounter = 0
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user