()
| 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 |
no test coverage detected