From 4becb152bb6052be3a7aa90bb5488624e6182698 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 11 May 2020 22:39:17 +0300 Subject: [PATCH] Changes for irc-framework update --- src/models/network.js | 6 ++++-- src/plugins/irc-events/connection.js | 11 +++-------- src/plugins/irc-events/ctcp.js | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/models/network.js b/src/models/network.js index dd4ae958..f19adae5 100644 --- a/src/models/network.js +++ b/src/models/network.js @@ -173,8 +173,10 @@ Network.prototype.createIrcFramework = function (client) { enable_echomessage: true, enable_setname: true, auto_reconnect: true, - auto_reconnect_wait: 10000 + Math.floor(Math.random() * 1000), // If multiple users are connected to the same network, randomize their reconnections a little - auto_reconnect_max_retries: 360, // At least one hour (plus timeouts) worth of reconnections + + // Exponential backoff maxes out at 300 seconds after 9 reconnects, + // it will keep trying for well over an hour (plus the timeouts) + auto_reconnect_max_retries: 30, }); this.setIrcFrameworkOptions(client); diff --git a/src/plugins/irc-events/connection.js b/src/plugins/irc-events/connection.js index d271a65b..029eefc2 100644 --- a/src/plugins/irc-events/connection.js +++ b/src/plugins/irc-events/connection.js @@ -178,14 +178,9 @@ module.exports = function (irc, network) { network.channels[0].pushMessage( client, new Msg({ - text: - "Disconnected from the network. Reconnecting in " + - Math.round(data.wait / 1000) + - " seconds… (Attempt " + - data.attempt + - " of " + - data.max_retries + - ")", + text: `Disconnected from the network. Reconnecting in ${Math.round( + data.wait / 1000 + )} seconds… (Attempt ${data.attempt})`, }), true ); diff --git a/src/plugins/irc-events/ctcp.js b/src/plugins/irc-events/ctcp.js index 5a898a01..70a46de8 100644 --- a/src/plugins/irc-events/ctcp.js +++ b/src/plugins/irc-events/ctcp.js @@ -8,7 +8,7 @@ const pkg = require("../../../package.json"); const ctcpResponses = { CLIENTINFO: () => - Object.getOwnPropertyNames(ctcpResponses) // TODO: This is currently handled by irc-framework + Object.getOwnPropertyNames(ctcpResponses) .filter((key) => key !== "CLIENTINFO" && typeof ctcpResponses[key] === "function") .join(" "), PING: ({message}) => message.substring(5),