Introduce some warnings if plugins send to much data
Reviewed By: passy Differential Revision: D28253456 fbshipit-source-id: 00259076a86cf53ee80282c798c229460d7e4633
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8e80ae980d
commit
ac0e28a2b1
@@ -436,6 +436,13 @@ export default class Client extends EventEmitter {
|
|||||||
const params: Params = data.params;
|
const params: Params = data.params;
|
||||||
const bytes = msg.length * 2; // string lengths are measured in UTF-16 units (not characters), so 2 bytes per char
|
const bytes = msg.length * 2; // string lengths are measured in UTF-16 units (not characters), so 2 bytes per char
|
||||||
emitBytesReceived(params.api, bytes);
|
emitBytesReceived(params.api, bytes);
|
||||||
|
if (bytes > 5 * 1024 * 1024 && params.api !== 'flipper-messages') {
|
||||||
|
console.warn(
|
||||||
|
`Plugin '${params.api}' received excessively large message for '${
|
||||||
|
params.method
|
||||||
|
}': ${Math.round(bytes / 1024)}kB`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const persistingPlugin: PluginDefinition | undefined =
|
const persistingPlugin: PluginDefinition | undefined =
|
||||||
this.store.getState().plugins.clientPlugins.get(params.api) ||
|
this.store.getState().plugins.clientPlugins.get(params.api) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user