From 122a23ab0a66efaa770d37c93eff2a366ca804dc Mon Sep 17 00:00:00 2001 From: Mario Mazzotti Date: Mon, 3 Mar 2025 12:49:40 -0300 Subject: [PATCH] Merge pull request #57680 from Expensify/revert-57255-tgolen-pingpong-triggeroffline [CP Staging] Revert "[No QA] Change offline status when Pusher PINGPONG fails" (cherry picked from commit 0b5045da6d439b0051e4a1e6f770ca79829ac750) (CP triggered by puneetlath) --- src/libs/actions/User.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/libs/actions/User.ts b/src/libs/actions/User.ts index d403cc1c3108..574225b20f38 100644 --- a/src/libs/actions/User.ts +++ b/src/libs/actions/User.ts @@ -30,7 +30,6 @@ import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import {isOffline} from '@libs/Network/NetworkStore'; import * as SequentialQueue from '@libs/Network/SequentialQueue'; -import NetworkConnection from '@libs/NetworkConnection'; import * as NumberUtils from '@libs/NumberUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import Pusher from '@libs/Pusher'; @@ -916,7 +915,6 @@ function subscribeToPusherPong() { // When any PONG event comes in, reset this flag so that checkforLatePongReplies will resume looking for missed PONGs pongHasBeenMissed = false; - NetworkConnection.setOfflineStatus(false, 'PONG event was recieved from the server so assuming that means the client is back online'); }); } @@ -940,9 +938,6 @@ function pingPusher() { const pingID = NumberUtils.rand64(); const pingTimestamp = Date.now(); - // Reset this flag so that checkforLatePongReplies will resume looking for missed PONGs (in the case we are coming back online after being offline for a bit) - pongHasBeenMissed = false; - // In local development, there can end up being multiple intervals running because when JS code is replaced with hot module replacement, the old interval is not cleared // and keeps running. This little bit of logic will attempt to keep multiple pings from happening. if (pingTimestamp - lastPingSentTimestamp < PING_INTERVAL_LENGTH_IN_SECONDS * 1000) { @@ -977,7 +972,6 @@ function checkforLatePongReplies() { // When going offline, reset the pingpong state so that when the network reconnects, the client will start fresh lastPingSentTimestamp = Date.now(); pongHasBeenMissed = true; - NetworkConnection.setOfflineStatus(true, 'PONG event was not received from the server in time so assuming that means the client is offline'); } else { Log.info(`[Pusher PINGPONG] Last PONG event was ${timeSinceLastPongReceived} ms ago so not going offline`); } @@ -986,11 +980,6 @@ function checkforLatePongReplies() { let pingPusherIntervalID: ReturnType; let checkforLatePongRepliesIntervalID: ReturnType; function initializePusherPingPong() { - // Skip doing the ping pong during tests so that the network isn't knocked offline, forcing tests to timeout - if (process.env.NODE_ENV === 'test') { - return; - } - // Only run the ping pong from the leader client if (!ActiveClientManager.isClientTheLeader()) { Log.info("[Pusher PINGPONG] Not starting PING PONG because this instance isn't the leader client");