Skip to content

Commit 715b783

Browse files
committed
log lastUpdateID
1 parent fc24e0a commit 715b783

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/libs/actions/OnyxUpdates.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ let pusherEventsPromise = Promise.resolve();
2626

2727
let airshipEventsPromise = Promise.resolve();
2828

29-
function applyHTTPSOnyxUpdates(request: Request, response: Response) {
29+
function applyHTTPSOnyxUpdates(request: Request, response: Response, lastUpdateID: number) {
3030
Performance.markStart(CONST.TIMING.APPLY_HTTPS_UPDATES);
31-
console.debug('[OnyxUpdateManager] Applying https update');
31+
Log.info('[OnyxUpdateManager] Applying https update', false, {lastUpdateID});
3232
// 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
3333
// the UI. See https://github.com/Expensify/App/issues/12775 for more info.
3434
const updateHandler: (updates: OnyxUpdate[]) => Promise<unknown> = request?.data?.apiRequestType === CONST.API_REQUEST_TYPE.WRITE ? queueOnyxUpdates : Onyx.update;
@@ -64,40 +64,40 @@ function applyHTTPSOnyxUpdates(request: Request, response: Response) {
6464
})
6565
.then(() => {
6666
Performance.markEnd(CONST.TIMING.APPLY_HTTPS_UPDATES);
67-
Log.info('[OnyxUpdateManager] Done applying HTTPS update');
67+
Log.info('[OnyxUpdateManager] Done applying HTTPS update', false, {lastUpdateID});
6868
return Promise.resolve(response);
6969
});
7070
}
7171

72-
function applyPusherOnyxUpdates(updates: OnyxUpdateEvent[]) {
72+
function applyPusherOnyxUpdates(updates: OnyxUpdateEvent[], lastUpdateID: number) {
7373
Performance.markStart(CONST.TIMING.APPLY_PUSHER_UPDATES);
7474

7575
pusherEventsPromise = pusherEventsPromise.then(() => {
76-
Log.info('[OnyxUpdateManager] Applying pusher update');
76+
Log.info('[OnyxUpdateManager] Applying pusher update', false, {lastUpdateID});
7777
});
7878

7979
pusherEventsPromise = updates
8080
.reduce((promise, update) => promise.then(() => PusherUtils.triggerMultiEventHandler(update.eventType, update.data)), pusherEventsPromise)
8181
.then(() => {
8282
Performance.markEnd(CONST.TIMING.APPLY_PUSHER_UPDATES);
83-
Log.info('[OnyxUpdateManager] Done applying Pusher update');
83+
Log.info('[OnyxUpdateManager] Done applying Pusher update', false, {lastUpdateID});
8484
});
8585

8686
return pusherEventsPromise;
8787
}
8888

89-
function applyAirshipOnyxUpdates(updates: OnyxUpdateEvent[]) {
89+
function applyAirshipOnyxUpdates(updates: OnyxUpdateEvent[], lastUpdateID: number) {
9090
Performance.markStart(CONST.TIMING.APPLY_AIRSHIP_UPDATES);
9191

9292
airshipEventsPromise = airshipEventsPromise.then(() => {
93-
Log.info('[OnyxUpdateManager] Applying Airship updates');
93+
Log.info('[OnyxUpdateManager] Applying Airship updates', false, {lastUpdateID});
9494
});
9595

9696
airshipEventsPromise = updates
9797
.reduce((promise, update) => promise.then(() => Onyx.update(update.data)), airshipEventsPromise)
9898
.then(() => {
9999
Performance.markEnd(CONST.TIMING.APPLY_AIRSHIP_UPDATES);
100-
Log.info('[OnyxUpdateManager] Done applying Airship updates');
100+
Log.info('[OnyxUpdateManager] Done applying Airship updates', false, {lastUpdateID});
101101
});
102102

103103
return airshipEventsPromise;
@@ -136,7 +136,7 @@ function apply({lastUpdateID, type, request, response, updates}: OnyxUpdatesFrom
136136

137137
// We use a spread here instead of delete because we don't want to change the response for other middlewares
138138
const {onyxData, ...responseWithoutOnyxData} = response;
139-
return applyHTTPSOnyxUpdates(request, responseWithoutOnyxData);
139+
return applyHTTPSOnyxUpdates(request, responseWithoutOnyxData, Number(lastUpdateID));
140140
}
141141

142142
return Promise.resolve();
@@ -145,13 +145,13 @@ function apply({lastUpdateID, type, request, response, updates}: OnyxUpdatesFrom
145145
Onyx.merge(ONYXKEYS.ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT, Number(lastUpdateID));
146146
}
147147
if (type === CONST.ONYX_UPDATE_TYPES.HTTPS && request && response) {
148-
return applyHTTPSOnyxUpdates(request, response);
148+
return applyHTTPSOnyxUpdates(request, response, Number(lastUpdateID));
149149
}
150150
if (type === CONST.ONYX_UPDATE_TYPES.PUSHER && updates) {
151-
return applyPusherOnyxUpdates(updates);
151+
return applyPusherOnyxUpdates(updates, Number(lastUpdateID));
152152
}
153153
if (type === CONST.ONYX_UPDATE_TYPES.AIRSHIP && updates) {
154-
return applyAirshipOnyxUpdates(updates);
154+
return applyAirshipOnyxUpdates(updates, Number(lastUpdateID));
155155
}
156156
}
157157

0 commit comments

Comments
 (0)