Filter duplicate requests

Summary:
Right now this is throwing an error, we instead gracefully
handle this. I'm not quite sure where this is coming from but as we're
not really doing anything with the requests before they're added here,
it must be coming from the network stack.

We can't really build another stable key on the client side because we
also need to match it up with the response. Open for ideas!

Changelog: Network requests with duplicate IDs are filtered out

Reviewed By: mweststrate

Differential Revision: D30337820

fbshipit-source-id: d312833727b383fa5f4d18a506ab581cd2151d13
This commit is contained in:
Pascal Hartig
2021-08-16 05:31:37 -07:00
committed by Facebook GitHub Bot
parent 797007f367
commit 09107460a3

View File

@@ -154,7 +154,12 @@ export function plugin(client: PluginClient<Events, Methods>) {
}); });
client.onMessage('newRequest', (data) => { client.onMessage('newRequest', (data) => {
requests.append(createRequestFromRequestInfo(data, customColumns.get())); // Some network stacks may send duplicate data, so we filter them out.
if (requests.has(data.id)) {
console.warn(`Ignoring duplicate request with id ${data.id}:`, data);
} else {
requests.append(createRequestFromRequestInfo(data, customColumns.get()));
}
}); });
function storeResponse(response: ResponseInfo) { function storeResponse(response: ResponseInfo) {