From fc24e0a3284b615105124e4e6cd936f24c5860e9 Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Thu, 31 Jul 2025 14:50:08 -0400 Subject: [PATCH 1/4] push logs to server --- src/libs/actions/OnyxUpdates.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libs/actions/OnyxUpdates.ts b/src/libs/actions/OnyxUpdates.ts index e60ba962d436..ad640c68cf9b 100644 --- a/src/libs/actions/OnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdates.ts @@ -64,7 +64,7 @@ function applyHTTPSOnyxUpdates(request: Request, response: Response) { }) .then(() => { Performance.markEnd(CONST.TIMING.APPLY_HTTPS_UPDATES); - console.debug('[OnyxUpdateManager] Done applying HTTPS update'); + Log.info('[OnyxUpdateManager] Done applying HTTPS update'); return Promise.resolve(response); }); } @@ -73,14 +73,14 @@ function applyPusherOnyxUpdates(updates: OnyxUpdateEvent[]) { Performance.markStart(CONST.TIMING.APPLY_PUSHER_UPDATES); pusherEventsPromise = pusherEventsPromise.then(() => { - console.debug('[OnyxUpdateManager] Applying pusher update'); + Log.info('[OnyxUpdateManager] Applying pusher update'); }); pusherEventsPromise = updates .reduce((promise, update) => promise.then(() => PusherUtils.triggerMultiEventHandler(update.eventType, update.data)), pusherEventsPromise) .then(() => { Performance.markEnd(CONST.TIMING.APPLY_PUSHER_UPDATES); - console.debug('[OnyxUpdateManager] Done applying Pusher update'); + Log.info('[OnyxUpdateManager] Done applying Pusher update'); }); return pusherEventsPromise; @@ -90,14 +90,14 @@ function applyAirshipOnyxUpdates(updates: OnyxUpdateEvent[]) { Performance.markStart(CONST.TIMING.APPLY_AIRSHIP_UPDATES); airshipEventsPromise = airshipEventsPromise.then(() => { - console.debug('[OnyxUpdateManager] Applying Airship updates'); + Log.info('[OnyxUpdateManager] Applying Airship updates'); }); airshipEventsPromise = updates .reduce((promise, update) => promise.then(() => Onyx.update(update.data)), airshipEventsPromise) .then(() => { Performance.markEnd(CONST.TIMING.APPLY_AIRSHIP_UPDATES); - console.debug('[OnyxUpdateManager] Done applying Airship updates'); + Log.info('[OnyxUpdateManager] Done applying Airship updates'); }); return airshipEventsPromise; From 715b78376738cd2eca402940fa7cf748d1e39d42 Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Thu, 31 Jul 2025 14:56:41 -0400 Subject: [PATCH 2/4] log lastUpdateID --- src/libs/actions/OnyxUpdates.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/libs/actions/OnyxUpdates.ts b/src/libs/actions/OnyxUpdates.ts index ad640c68cf9b..44e7636bbde4 100644 --- a/src/libs/actions/OnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdates.ts @@ -26,9 +26,9 @@ let pusherEventsPromise = Promise.resolve(); let airshipEventsPromise = Promise.resolve(); -function applyHTTPSOnyxUpdates(request: Request, response: Response) { +function applyHTTPSOnyxUpdates(request: Request, response: Response, lastUpdateID: number) { Performance.markStart(CONST.TIMING.APPLY_HTTPS_UPDATES); - console.debug('[OnyxUpdateManager] Applying https update'); + Log.info('[OnyxUpdateManager] Applying https update', false, {lastUpdateID}); // For most requests we can immediately update Onyx. For write requests we queue the updates and apply them after the sequential queue has flushed to prevent a replay effect in // the UI. See https://github.com/Expensify/App/issues/12775 for more info. const updateHandler: (updates: OnyxUpdate[]) => Promise = request?.data?.apiRequestType === CONST.API_REQUEST_TYPE.WRITE ? queueOnyxUpdates : Onyx.update; @@ -64,40 +64,40 @@ function applyHTTPSOnyxUpdates(request: Request, response: Response) { }) .then(() => { Performance.markEnd(CONST.TIMING.APPLY_HTTPS_UPDATES); - Log.info('[OnyxUpdateManager] Done applying HTTPS update'); + Log.info('[OnyxUpdateManager] Done applying HTTPS update', false, {lastUpdateID}); return Promise.resolve(response); }); } -function applyPusherOnyxUpdates(updates: OnyxUpdateEvent[]) { +function applyPusherOnyxUpdates(updates: OnyxUpdateEvent[], lastUpdateID: number) { Performance.markStart(CONST.TIMING.APPLY_PUSHER_UPDATES); pusherEventsPromise = pusherEventsPromise.then(() => { - Log.info('[OnyxUpdateManager] Applying pusher update'); + Log.info('[OnyxUpdateManager] Applying pusher update', false, {lastUpdateID}); }); pusherEventsPromise = updates .reduce((promise, update) => promise.then(() => PusherUtils.triggerMultiEventHandler(update.eventType, update.data)), pusherEventsPromise) .then(() => { Performance.markEnd(CONST.TIMING.APPLY_PUSHER_UPDATES); - Log.info('[OnyxUpdateManager] Done applying Pusher update'); + Log.info('[OnyxUpdateManager] Done applying Pusher update', false, {lastUpdateID}); }); return pusherEventsPromise; } -function applyAirshipOnyxUpdates(updates: OnyxUpdateEvent[]) { +function applyAirshipOnyxUpdates(updates: OnyxUpdateEvent[], lastUpdateID: number) { Performance.markStart(CONST.TIMING.APPLY_AIRSHIP_UPDATES); airshipEventsPromise = airshipEventsPromise.then(() => { - Log.info('[OnyxUpdateManager] Applying Airship updates'); + Log.info('[OnyxUpdateManager] Applying Airship updates', false, {lastUpdateID}); }); airshipEventsPromise = updates .reduce((promise, update) => promise.then(() => Onyx.update(update.data)), airshipEventsPromise) .then(() => { Performance.markEnd(CONST.TIMING.APPLY_AIRSHIP_UPDATES); - Log.info('[OnyxUpdateManager] Done applying Airship updates'); + Log.info('[OnyxUpdateManager] Done applying Airship updates', false, {lastUpdateID}); }); return airshipEventsPromise; @@ -136,7 +136,7 @@ function apply({lastUpdateID, type, request, response, updates}: OnyxUpdatesFrom // We use a spread here instead of delete because we don't want to change the response for other middlewares const {onyxData, ...responseWithoutOnyxData} = response; - return applyHTTPSOnyxUpdates(request, responseWithoutOnyxData); + return applyHTTPSOnyxUpdates(request, responseWithoutOnyxData, Number(lastUpdateID)); } return Promise.resolve(); @@ -145,13 +145,13 @@ function apply({lastUpdateID, type, request, response, updates}: OnyxUpdatesFrom Onyx.merge(ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT, Number(lastUpdateID)); } if (type === CONST.ONYX_UPDATE_TYPES.HTTPS && request && response) { - return applyHTTPSOnyxUpdates(request, response); + return applyHTTPSOnyxUpdates(request, response, Number(lastUpdateID)); } if (type === CONST.ONYX_UPDATE_TYPES.PUSHER && updates) { - return applyPusherOnyxUpdates(updates); + return applyPusherOnyxUpdates(updates, Number(lastUpdateID)); } if (type === CONST.ONYX_UPDATE_TYPES.AIRSHIP && updates) { - return applyAirshipOnyxUpdates(updates); + return applyAirshipOnyxUpdates(updates, Number(lastUpdateID)); } } From 133adf5e98b9098f6e2c7716d2419706b5cedec1 Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Thu, 31 Jul 2025 15:03:53 -0400 Subject: [PATCH 3/4] fix mock --- src/libs/actions/__mocks__/OnyxUpdates.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/__mocks__/OnyxUpdates.ts b/src/libs/actions/__mocks__/OnyxUpdates.ts index 3e4cb10d7f9e..f7db5a64710d 100644 --- a/src/libs/actions/__mocks__/OnyxUpdates.ts +++ b/src/libs/actions/__mocks__/OnyxUpdates.ts @@ -24,7 +24,7 @@ const apply = jest.fn(({lastUpdateID, request, response}: OnyxUpdatesFromServer) } if (request && response) { - return applyHTTPSOnyxUpdates(request, response).then(() => undefined); + return applyHTTPSOnyxUpdates(request, response, Number(lastUpdateID)).then(() => undefined); } return Promise.resolve(); From ad6e0f687e79765fa7fa1d9f9190259bf7565e43 Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Thu, 31 Jul 2025 15:05:38 -0400 Subject: [PATCH 4/4] add lastUpdateID --- .../PushNotification/subscribeToPushNotifications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts b/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts index c715c312ef37..10b922aa6688 100644 --- a/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts +++ b/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts @@ -52,7 +52,7 @@ Onyx.connect({ }); function applyOnyxData({reportID, onyxData, lastUpdateID, previousUpdateID, hasPendingOnyxUpdates = false}: PushNotificationData): Promise { - Log.info(`[PushNotification] Applying onyx data in the ${Visibility.isVisible() ? 'foreground' : 'background'}`, false, {reportID}); + Log.info(`[PushNotification] Applying onyx data in the ${Visibility.isVisible() ? 'foreground' : 'background'}`, false, {reportID, lastUpdateID}); const logMissingOnyxDataInfo = (isDataMissing: boolean): boolean => { if (isDataMissing) {