Add ability to disable restart service

Sometimes it will be needed to not auto restart shards, so this adds the ability to prevent the API server from forcing shard restarts.
This commit is contained in:
NovaFox161
2020-08-03 04:02:54 -05:00
parent fea567d73a
commit 402c43fd70
2 changed files with 6 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ public enum BotSettings {
DEBUG_WEBHOOK, ERROR_WEBHOOK, STATUS_WEBHOOK,
USE_REDIS_STORES, USE_WEBHOOKS, UPDATE_SITES,
USE_REDIS_STORES, USE_WEBHOOKS, UPDATE_SITES, USE_RESTART_SERVICE,
BOT_API_TOKEN,

View File

@@ -65,6 +65,11 @@ public class NetworkMediator {
}
private String issueRestart(final ConnectedClient c) {
if (!"true".equalsIgnoreCase(BotSettings.USE_RESTART_SERVICE.get())) {
DisCalServer.getNetworkInfo().removeClient(c.getClientIndex(), "Restart service not active!");
return "INACTIVE";
}
try {
final Session session = this.createSession(c.getIpForRestart(), c.getPortForRestart());
session.connect();