From 6e6873a4f6f38bb5eb685d11a4e22c57f7a30fba Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Fri, 4 Oct 2019 05:28:36 -0700 Subject: [PATCH] Pass idler and statusupdate callback as an argument to the export persisted state function Summary: This diff passes the idler and statusUpdate arguments to the export persisted state, as it is being used in the MobileConfig's export function Reviewed By: passy Differential Revision: D17715815 fbshipit-source-id: 98a0f0f5950254de2139c4aaa52cb73401c86c3c --- src/plugin.tsx | 2 ++ src/utils/exportData.tsx | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugin.tsx b/src/plugin.tsx index 617a6889b..86c9b8ead 100644 --- a/src/plugin.tsx +++ b/src/plugin.tsx @@ -101,6 +101,8 @@ export abstract class FlipperBasePlugin< callClient: (method: string, params?: any) => Promise, persistedState: StaticPersistedState | undefined, store: MiddlewareAPI | undefined, + idler?: Idler, + statusUpdate?: (msg: string) => void, ) => Promise) | null; static getActiveNotifications: diff --git a/src/utils/exportData.tsx b/src/utils/exportData.tsx index e0de69b1b..54babd164 100644 --- a/src/utils/exportData.tsx +++ b/src/utils/exportData.tsx @@ -381,6 +381,7 @@ export async function fetchMetadata( pluginsMap: Map, store: MiddlewareAPI, statusUpdate?: (msg: string) => void, + idler?: Idler, ): Promise<{pluginStates: PluginStatesState; errorArray: Array}> { const newPluginState = {...pluginStates}; const errorArray: Array = []; @@ -413,7 +414,13 @@ export async function fetchMetadata( statusUpdate(`Fetching metadata for plugin ${plugin}...`); const data = await promiseTimeout( 120000, // Timeout in 2 mins - exportState(callClient(client, plugin), newPluginState[key], store), + exportState( + callClient(client, plugin), + newPluginState[key], + store, + idler, + statusUpdate, + ), `Timed out while collecting data for ${plugin}`, ); newPluginState[key] = data; @@ -459,6 +466,7 @@ export async function getStoreExport( pluginsMap, store, statusUpdate, + idler, ); const {errorArray} = metadata; const newPluginState = metadata.pluginStates;