* Marks this host as not available for query coordination, when the host was previously marked as UP, otherwise its * a no-op. * @internal * @ignore
()
| 139 | * @ignore |
| 140 | */ |
| 141 | setDown() { |
| 142 | // Multiple events signaling that a host is failing could cause multiple calls to this method |
| 143 | if (this.setDownAt !== 0) { |
| 144 | // the host is already marked as Down |
| 145 | return; |
| 146 | } |
| 147 | if (this.pool.isClosing()) { |
| 148 | // the pool is being closed/shutdown, don't mind |
| 149 | return; |
| 150 | } |
| 151 | this.setDownAt = Date.now(); |
| 152 | if (this.pool.coreConnectionsLength > 0) { |
| 153 | // According to the distance, there should be connections open to it => issue a warning |
| 154 | this.log('warning', `Host ${this.address} considered as DOWN. Reconnection delay ${this.reconnectionDelay}ms.`); |
| 155 | } |
| 156 | else { |
| 157 | this.log('info', `Host ${this.address} considered as DOWN.`); |
| 158 | } |
| 159 | this.emit('down'); |
| 160 | this._checkPoolState(); |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Marks this host as available for querying. |
no test coverage detected