Skip to content

Commit 02b4287

Browse files
authored
Merge pull request Expensify#64178 from callstack-internal/gedu/pause_logs
[NoQA] Add some logs before Queue is pause
2 parents 0fa3b40 + e13f6e1 commit 02b4287

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Onyx from 'react-native-onyx';
22
import type {DeferredUpdatesDictionary} from '@libs/actions/OnyxUpdateManager/types';
3+
import Log from '@libs/Log';
34
import * as SequentialQueue from '@libs/Network/SequentialQueue';
45
import CONST from '@src/CONST';
56
import ONYXKEYS from '@src/ONYXKEYS';
@@ -78,6 +79,7 @@ type EnqueueDeferredOnyxUpdatesOptions = {
7879
*/
7980
function enqueue(updates: OnyxUpdatesFromServer | DeferredUpdatesDictionary, options?: EnqueueDeferredOnyxUpdatesOptions) {
8081
if (options?.shouldPauseSequentialQueue ?? true) {
82+
Log.info('[DeferredOnyxUpdates] Pausing SequentialQueue');
8183
SequentialQueue.pause();
8284
}
8385

src/libs/actions/User.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ function subscribeToUserEvents() {
906906
updates: pushEventData.updates ?? [],
907907
previousUpdateID: Number(pushJSON.previousUpdateID ?? CONST.DEFAULT_NUMBER_ID),
908908
};
909+
Log.info('[subscribeToUserEvents] Applying Onyx updates');
909910
applyOnyxUpdatesReliably(updates);
910911
});
911912

src/libs/actions/applyOnyxUpdatesReliably.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import Log from '@libs/Log';
12
import * as SequentialQueue from '@libs/Network/SequentialQueue';
23
import CONST from '@src/CONST';
34
import type {OnyxUpdatesFromServer} from '@src/types/onyx';
45
import {handleMissingOnyxUpdates} from './OnyxUpdateManager';
5-
import * as OnyxUpdates from './OnyxUpdates';
6+
import {doesClientNeedToBeUpdated, apply as onyxApply, saveUpdateInformation} from './OnyxUpdates';
67

78
type ApplyOnyxUpdatesReliablyOptions = {
89
clientLastUpdateID?: number;
@@ -20,6 +21,7 @@ type ApplyOnyxUpdatesReliablyOptions = {
2021
*/
2122
export default function applyOnyxUpdatesReliably(updates: OnyxUpdatesFromServer, {shouldRunSync = false, clientLastUpdateID}: ApplyOnyxUpdatesReliablyOptions = {}) {
2223
const fetchMissingUpdates = () => {
24+
Log.info('[applyOnyxUpdatesReliably] Fetching missing updates');
2325
// If we got here, that means we are missing some updates on our local storage. To
2426
// guarantee that we're not fetching more updates before our local data is up to date,
2527
// let's stop the sequential queue from running until we're done catching up.
@@ -28,7 +30,7 @@ export default function applyOnyxUpdatesReliably(updates: OnyxUpdatesFromServer,
2830
if (shouldRunSync) {
2931
handleMissingOnyxUpdates(updates, clientLastUpdateID);
3032
} else {
31-
OnyxUpdates.saveUpdateInformation(updates);
33+
saveUpdateInformation(updates);
3234
}
3335
};
3436

@@ -40,8 +42,8 @@ export default function applyOnyxUpdatesReliably(updates: OnyxUpdatesFromServer,
4042
}
4143

4244
const previousUpdateID = Number(updates.previousUpdateID) ?? CONST.DEFAULT_NUMBER_ID;
43-
if (!OnyxUpdates.doesClientNeedToBeUpdated({previousUpdateID, clientLastUpdateID})) {
44-
OnyxUpdates.apply(updates);
45+
if (!doesClientNeedToBeUpdated({previousUpdateID, clientLastUpdateID})) {
46+
onyxApply(updates);
4547
return;
4648
}
4749

0 commit comments

Comments
 (0)