Fix regression in background state

Summary: `flipperPrintPluginBackgroundStats()` tended to report the class name rather than the given plugin id

Reviewed By: jknoxville

Differential Revision: D19250706

fbshipit-source-id: 6035892bacf6a592d8c510320d5e003fac580ec7
This commit is contained in:
Michel Weststrate
2020-01-02 07:12:06 -08:00
committed by Facebook Github Bot
parent 622d3ee3f0
commit 1caf5d5d3a

View File

@@ -74,12 +74,12 @@ function processMessage(
state: State, state: State,
pluginKey: string, pluginKey: string,
plugin: { plugin: {
name: string; id: string;
persistedStateReducer: PersistedStateReducer | null; persistedStateReducer: PersistedStateReducer | null;
}, },
message: {method: string; params?: any}, message: {method: string; params?: any},
): State { ): State {
const statName = `${plugin.name}.${message.method}`; const statName = `${plugin.id}.${message.method}`;
const reducerStartTime = Date.now(); const reducerStartTime = Date.now();
flipperRecorderAddEvent(pluginKey, message.method, message.params); flipperRecorderAddEvent(pluginKey, message.method, message.params);
try { try {
@@ -91,7 +91,7 @@ function processMessage(
addBackgroundStat(statName, Date.now() - reducerStartTime); addBackgroundStat(statName, Date.now() - reducerStartTime);
return newPluginState; return newPluginState;
} catch (e) { } catch (e) {
console.error(`Failed to process event for plugin ${plugin.name}`, e); console.error(`Failed to process event for plugin ${plugin.id}`, e);
return state; return state;
} }
} }
@@ -101,7 +101,7 @@ export function processMessageImmediately(
pluginKey: string, pluginKey: string,
plugin: { plugin: {
defaultPersistedState: any; defaultPersistedState: any;
name: string; id: string;
persistedStateReducer: PersistedStateReducer | null; persistedStateReducer: PersistedStateReducer | null;
}, },
message: {method: string; params?: any}, message: {method: string; params?: any},
@@ -131,7 +131,7 @@ export function processMessageLater(
pluginKey: string, pluginKey: string,
plugin: { plugin: {
defaultPersistedState: any; defaultPersistedState: any;
name: string; id: string;
persistedStateReducer: PersistedStateReducer | null; persistedStateReducer: PersistedStateReducer | null;
maxQueueSize?: number; maxQueueSize?: number;
}, },
@@ -169,7 +169,7 @@ export function processMessageLater(
export async function processMessageQueue( export async function processMessageQueue(
plugin: { plugin: {
defaultPersistedState: any; defaultPersistedState: any;
name: string; id: string;
persistedStateReducer: PersistedStateReducer | null; persistedStateReducer: PersistedStateReducer | null;
}, },
pluginKey: string, pluginKey: string,