* Validates that the internal state of the connection pool. * If the pool size is smaller than expected, schedule a new connection attempt. * If the amount of connections is 0 for not ignored hosts, the host must be down. * @private
()
| 379 | * @private |
| 380 | */ |
| 381 | _checkPoolState() { |
| 382 | if (this.pool.isClosing()) { |
| 383 | return; |
| 384 | } |
| 385 | if (this.pool.connections.length < this.pool.coreConnectionsLength) { |
| 386 | // the pool needs to grow / reconnect |
| 387 | if (!this.pool.hasScheduledNewConnection()) { |
| 388 | this.reconnectionDelay = this.reconnectionSchedule.next().value; |
| 389 | this.pool.scheduleNewConnectionAttempt(this.reconnectionDelay); |
| 390 | } |
| 391 | } |
| 392 | const shouldHaveConnections = this._distance !== types.distance.ignored && this.pool.coreConnectionsLength > 0; |
| 393 | if (shouldHaveConnections && this.pool.connections.length === 0) { |
| 394 | // Mark as DOWN, if its UP |
| 395 | this.setDown(); |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * Executed after an scheduled new connection attempt finished |
no test coverage detected