modify default timeout to 120 seconds and add in enironment variable to allow changing it
parent
456b9568ff
commit
ccf9ab8c8a
|
@ -49,7 +49,7 @@ class SocketConsumer extends Socket {
|
||||||
// if keepAlive is true then consumer will also be reconnecting consumer
|
// if keepAlive is true then consumer will also be reconnecting consumer
|
||||||
this.keepAlive = 'keepAlive' in opts ? opts.keepAlive : true
|
this.keepAlive = 'keepAlive' in opts ? opts.keepAlive : true
|
||||||
this._ready = false
|
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.wait = opts.wait || 2
|
||||||
this.stream = new JsonStream()
|
this.stream = new JsonStream()
|
||||||
// bind to class for other class functions
|
// bind to class for other class functions
|
||||||
|
@ -67,10 +67,7 @@ class SocketConsumer extends Socket {
|
||||||
// this is only for initial connection
|
// this is only for initial connection
|
||||||
const initTimeout = setTimeout(() => {
|
const initTimeout = setTimeout(() => {
|
||||||
log.fatal({method:'connect', line:69, opts: this.opts, msg:`unable to connect in ${this.timeout}s`})
|
log.fatal({method:'connect', line:69, opts: this.opts, msg:`unable to connect in ${this.timeout}s`})
|
||||||
reject(
|
reject({ opts: this.opts },`unable to connect to socket server in ${this.timeout}secs`)
|
||||||
{ opts: this.opts },
|
|
||||||
`unable to connect to socket server in ${this.timeout}secs`
|
|
||||||
)
|
|
||||||
}, this.timeout * 1000)
|
}, this.timeout * 1000)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue