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

Method _idleTimeoutHandler

lib/connection.js:599–619  ·  view source on GitHub ↗

* Function that gets executed once the idle timeout has passed to issue a request to keep the connection alive

()

Source from the content-addressed store, hash-verified

597 * Function that gets executed once the idle timeout has passed to issue a request to keep the connection alive
598 */
599 _idleTimeoutHandler() {
600 if (this.sendingIdleQuery) {
601 //don't issue another
602 //schedule for next time
603 this._idleTimeout = setTimeout(() => this._idleTimeoutHandler(), this.options.pooling.heartBeatInterval);
604 return;
605 }
606
607 this.log('verbose', `Connection to ${this.endpointFriendlyName} idling, issuing a request to prevent disconnects`);
608 this.sendingIdleQuery = true;
609 this.sendStream(requests.options, null, (err) => {
610 this.sendingIdleQuery = false;
611 if (!err) {
612 //The sending succeeded
613 //There is a valid response but we don't care about the response
614 return;
615 }
616 this.log('warning', 'Received heartbeat request error', err);
617 this.emit('idleRequestError', err, this);
618 });
619 }
620
621 /**
622 * Returns an available streamId or null if there isn't any available

Callers 1

_setIdleTimeoutMethod · 0.80

Calls 1

sendStreamMethod · 0.95

Tested by

no test coverage detected