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

Method _setIdleTimeout

lib/connection.js:581–594  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

579 }
580
581 _setIdleTimeout() {
582 if (!this.options.pooling.heartBeatInterval) {
583 return;
584 }
585 const self = this;
586 // Scheduling the new timeout before de-scheduling the previous performs significantly better
587 // than de-scheduling first, see nodejs implementation: https://github.com/nodejs/node/blob/master/lib/timers.js
588 const previousTimeout = this._idleTimeout;
589 self._idleTimeout = setTimeout(() => self._idleTimeoutHandler(), self.options.pooling.heartBeatInterval);
590 if (previousTimeout) {
591 //remove the previous timeout for the idle request
592 clearTimeout(previousTimeout);
593 }
594 }
595
596 /**
597 * Function that gets executed once the idle timeout has passed to issue a request to keep the connection alive

Callers 1

_writeMethod · 0.80

Calls 1

_idleTimeoutHandlerMethod · 0.80

Tested by

no test coverage detected