From ccf9ab8c8a344cd898a996f95bad70e28895a01e Mon Sep 17 00:00:00 2001 From: David Kebler Date: Wed, 1 May 2019 15:34:07 -0700 Subject: [PATCH] modify default timeout to 120 seconds and add in enironment variable to allow changing it --- src/consumer.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/consumer.js b/src/consumer.js index a314e42..2189da7 100644 --- a/src/consumer.js +++ b/src/consumer.js @@ -49,7 +49,7 @@ class SocketConsumer extends Socket { // if keepAlive is true then consumer will also be reconnecting consumer this.keepAlive = 'keepAlive' in opts ? opts.keepAlive : true this._ready = false - this.timeout = opts.timeout || 60 // initial connect timeout in secs and then rejects + this.timeout = opts.timeout || process.env.UCI_CONNECT_TIMEOUT || 120 // initial connect timeout in secs and then rejects this.wait = opts.wait || 2 this.stream = new JsonStream() // bind to class for other class functions @@ -67,10 +67,7 @@ class SocketConsumer extends Socket { // this is only for initial connection const initTimeout = setTimeout(() => { log.fatal({method:'connect', line:69, opts: this.opts, msg:`unable to connect in ${this.timeout}s`}) - reject( - { opts: this.opts }, - `unable to connect to socket server in ${this.timeout}secs` - ) + reject({ opts: this.opts },`unable to connect to socket server in ${this.timeout}secs`) }, this.timeout * 1000)