Skip to content

Commit

Permalink
fix(connection): remove heartbeat check when getting connection ready…
Browse files Browse the repository at this point in the history
…State

Fix #15042
Revert #14812
  • Loading branch information
vkarpov15 committed Dec 10, 2024
1 parent 2607904 commit 94f1bc8
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 94f1bc8

Please sign in to comment.