Skip to content

Commit c20267b

Browse files
Fix negative offset of reconnect delay (firebase#8718)
1 parent 2ec1c76 commit c20267b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/database/src/core/PersistentConnection.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,10 @@ export class PersistentConnection extends ServerActions {
797797
this.lastConnectionEstablishedTime_ = null;
798798
}
799799

800-
const timeSinceLastConnectAttempt =
801-
new Date().getTime() - this.lastConnectionAttemptTime_;
800+
const timeSinceLastConnectAttempt = Math.max(
801+
0,
802+
new Date().getTime() - this.lastConnectionAttemptTime_
803+
);
802804
let reconnectDelay = Math.max(
803805
0,
804806
this.reconnectDelay_ - timeSinceLastConnectAttempt

0 commit comments

Comments
 (0)