fix: EndCommand while cloop running deadlocks the executor causing the bot to not reconnect and bricks (absolute cinema)
This commit is contained in:
@@ -1 +1 @@
|
||||
3439
|
||||
3444
|
||||
@@ -379,9 +379,9 @@ public class Bot extends SessionAdapter {
|
||||
final String stringMessage = ComponentUtilities.stringify(disconnectedEvent.getReason());
|
||||
|
||||
if (
|
||||
stringMessage.equals("Wait 5 seconds before connecting, thanks! :)") ||
|
||||
stringMessage.equals("You are logging in too fast, try again later.") ||
|
||||
stringMessage.equals("Connection throttled! Please wait before reconnecting.")
|
||||
stringMessage.equals("Wait 5 seconds before connecting, thanks! :)")
|
||||
|| stringMessage.equals("You are logging in too fast, try again later.")
|
||||
|| stringMessage.equals("Connection throttled! Please wait before reconnecting.")
|
||||
) reconnectDelay = 1000 * (5 + 2); // 2 seconds extra delay just in case
|
||||
|
||||
executor.schedule(this::reconnect, reconnectDelay, TimeUnit.MILLISECONDS);
|
||||
|
||||
@@ -24,7 +24,9 @@ public class EndCommand extends Command {
|
||||
|
||||
final Bot bot = context.bot;
|
||||
|
||||
bot.session.disconnect(I18nUtilities.get("commands.end.disconnect_reason"));
|
||||
bot.executorService.execute(
|
||||
() -> bot.session.disconnect(I18nUtilities.get("commands.end.disconnect_reason"))
|
||||
);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user