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
This commit is contained in:
Pritesh Nandgaonkar
2019-10-04 05:28:36 -07:00
committed by Facebook Github Bot
parent 485898f5c7
commit 6e6873a4f6
2 changed files with 11 additions and 1 deletions

View File

@@ -381,6 +381,7 @@ export async function fetchMetadata(
pluginsMap: Map<string, typeof FlipperDevicePlugin | typeof FlipperPlugin>,
store: MiddlewareAPI,
statusUpdate?: (msg: string) => void,
idler?: Idler,
): Promise<{pluginStates: PluginStatesState; errorArray: Array<Error>}> {
const newPluginState = {...pluginStates};
const errorArray: Array<Error> = [];
@@ -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;