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
1 changed files with 2 additions and 0 deletions

View File

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