* Function that gets executed once the idle timeout has passed to issue a request to keep the connection alive
()
| 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 |
no test coverage detected