mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tweak IRC fix #430 to not create multiple clients on extended reconnects
This commit is contained in:
parent
43f55c6038
commit
d950ceceea
@ -51,6 +51,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
node.serverConfig.ircclient.addListener('netError', function(message) {
|
||||
node.log(JSON.stringify("NET "+message));
|
||||
node.serverConfig.lastseen = Date.now();
|
||||
});
|
||||
node.serverConfig.ircclient.addListener('connect', function() {
|
||||
node.serverConfig.lastseen = Date.now();
|
||||
@ -64,7 +65,7 @@ module.exports = function(RED) {
|
||||
if ((Date.now()-node.serverConfig.lastseen) > 300000) { // if more than 5 mins since last seen
|
||||
node.ircclient.send.apply(node.ircclient,["TIME"]); // request time to check link
|
||||
}
|
||||
if ((Date.now()-node.serverConfig.lastseen) > 603000) { // If more than 10 mins
|
||||
if ((Date.now()-node.serverConfig.lastseen) > 400000) { // If more than 6.5 mins
|
||||
node.serverConfig.ircclient.disconnect();
|
||||
node.serverConfig.ircclient.connect();
|
||||
node.log("Reconnect"); // then retry
|
||||
@ -152,6 +153,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
node.serverConfig.ircclient.addListener('netError', function(message) {
|
||||
node.log(JSON.stringify("NET "+message));
|
||||
node.serverConfig.lastseen = Date.now();
|
||||
});
|
||||
node.serverConfig.ircclient.addListener('connect', function() {
|
||||
node.serverConfig.lastseen = Date.now();
|
||||
@ -165,7 +167,7 @@ module.exports = function(RED) {
|
||||
if ((Date.now()-node.serverConfig.lastseen) > 300000) { // if more than 5 mins since last seen
|
||||
node.ircclient.send.apply(node.ircclient,["TIME"]); // request time to check link
|
||||
}
|
||||
if ((Date.now()-node.serverConfig.lastseen) > 603000) { // If more than 10 mins
|
||||
if ((Date.now()-node.serverConfig.lastseen) > 400000) { // If more than 6.5 mins
|
||||
node.serverConfig.ircclient.disconnect();
|
||||
node.serverConfig.ircclient.connect();
|
||||
console.log("Reconnect"); // then retry
|
||||
|
Loading…
Reference in New Issue
Block a user