From 18902317e32d680109b9313dc422bece44eb6122 Mon Sep 17 00:00:00 2001 From: Andrew Twyman Date: Mon, 22 Jul 2024 17:09:40 -0700 Subject: [PATCH] More detailed diagnostics for feed actions (#1834) These logged stats came up as somewhat misleading while debugging lost PODs. This PR adds more detail. --- apps/passport-client/src/dispatch.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/passport-client/src/dispatch.ts b/apps/passport-client/src/dispatch.ts index d4b73d8856..a70a1892df 100644 --- a/apps/passport-client/src/dispatch.ts +++ b/apps/passport-client/src/dispatch.ts @@ -1069,16 +1069,24 @@ async function doSync( } } console.log("[SYNC] initalized credentialManager", credentialManager); - const actions = await state.subscriptions.pollSubscriptions( + const stats = { nActions: 0, nFeeds: 0 }; + const subscriptionActions = await state.subscriptions.pollSubscriptions( credentialManager, async (actions) => { await applyActions(state.pcds, [actions]); await savePCDs(state.pcds); await saveSubscriptions(state.subscriptions); + stats.nActions += actions.actions.length; + stats.nFeeds++; } ); - console.log(`[SYNC] Applied ${actions.length} actions`); + console.log( + `[SYNC] Applied ${stats.nActions} actions from ` + + `${subscriptionActions.length}/${ + state.subscriptions.getActiveSubscriptions().length + } feeds` + ); } catch (e) { console.log(`[SYNC] failed to load issued PCDs, skipping this step`, e); }