From 94f1bc8948c78032cb0c6fd57a7c12035586e0e9 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 10 Dec 2024 11:57:44 -0500 Subject: [PATCH] fix(connection): remove heartbeat check when getting connection readyState Fix #15042 Revert #14812 --- lib/connection.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/connection.js b/lib/connection.js index 0b3ec6ae0e..2e0caf5c59 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -106,15 +106,6 @@ Object.setPrototypeOf(Connection.prototype, EventEmitter.prototype); Object.defineProperty(Connection.prototype, 'readyState', { get: function() { - // If connection thinks it is connected, but we haven't received a heartbeat in 2 heartbeat intervals, - // that likely means the connection is stale (potentially due to frozen AWS Lambda container) - if ( - this._readyState === STATES.connected && - this._lastHeartbeatAt != null && - typeof this.client?.topology?.s?.description?.heartbeatFrequencyMS === 'number' && - Date.now() - this._lastHeartbeatAt >= this.client.topology.s.description.heartbeatFrequencyMS * 2) { - return STATES.disconnected; - } return this._readyState; }, set: function(val) {