1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Merge pull request #701 from guzba/patch-1

Attempt to mitigate stream server connect feedback loop
This commit is contained in:
Nick O'Leary 2020-10-13 22:36:19 +01:00 committed by GitHub
commit 1253e7b6be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,6 +125,7 @@ module.exports = function(RED) {
stream.on('close', function() { stream.on('close', function() {
self.emitter.emit('stream_disconnected'); self.emitter.emit('stream_disconnected');
if (!closing) { if (!closing) {
if (tout) { clearTimeout(tout); }
tout = setTimeout(function() { tout = setTimeout(function() {
stream.connect(); stream.connect();
}, 15000); }, 15000);
@ -133,6 +134,7 @@ module.exports = function(RED) {
stream.on('error', function(err) { stream.on('error', function(err) {
self.emitter.emit('stream_error', err); self.emitter.emit('stream_error', err);
if (!closing) { if (!closing) {
if (tout) { clearTimeout(tout); }
tout = setTimeout(function() { tout = setTimeout(function() {
stream.connect(); stream.connect();
}, 15000); }, 15000);