MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / setDown

Method setDown

lib/host.js:141–161  ·  view source on GitHub ↗

* Marks this host as not available for query coordination, when the host was previously marked as UP, otherwise its * a no-op. * @internal * @ignore

()

Source from the content-addressed store, hash-verified

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.

Callers 4

_checkPoolStateMethod · 0.95
setPeersInfoMethod · 0.80
host-tests.jsFile · 0.80

Calls 2

_checkPoolStateMethod · 0.95
isClosingMethod · 0.80

Tested by

no test coverage detected