WIP: initial prototype
- Added support for request timeout - Improved deserializer - Fixed minor bugs - Fixed typos
This commit is contained in:
@ -10,7 +10,8 @@ class ConnectionPool {
|
||||
this.alive = []
|
||||
this.dead = []
|
||||
this.selector = opts.selector
|
||||
this.sll = opts.sll
|
||||
this._ssl = opts.ssl
|
||||
this._agent = opts.agent
|
||||
// the resurrect timeout is 60s
|
||||
// we multiply it by 2 because the resurrect formula is
|
||||
// `Math.pow(resurrectTimeout * 2, deadCount -1)`
|
||||
@ -143,12 +144,17 @@ class ConnectionPool {
|
||||
if (typeof opts === 'string') {
|
||||
opts = this.urlToHost(opts)
|
||||
}
|
||||
Object.assign(opts, this.ssl)
|
||||
if (opts.ssl == null) opts.ssl = this._ssl
|
||||
if (opts.agent == null) opts.agent = this._agent
|
||||
|
||||
const connection = new Connection(opts)
|
||||
debug('Adding a new connection', connection)
|
||||
if (this.connections.has(connection.id)) {
|
||||
throw new Error(`Connection with id '${connection.id} is already present`)
|
||||
}
|
||||
this.connections.set(connection.id, connection)
|
||||
this.alive.push(connection.id)
|
||||
return this
|
||||
return connection
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user