track onMessage performance

Summary: Tracking the time of onMessage callback

Reviewed By: passy

Differential Revision: D15536546

fbshipit-source-id: 9e93c11555a0a045ef60355ec1d0c6ca7cd49cdd
This commit is contained in:
Daniel Büchele
2019-05-29 08:19:29 -07:00
committed by Facebook Github Bot
parent cb79b3b9ba
commit 6aa3457fb4

View File

@@ -112,9 +112,17 @@ export default class Client extends EventEmitter {
const client = this;
this.responder = {
fireAndForget: (payload: {data: string}) =>
requestIdleCallback(() => client.onMessage(payload.data), {
requestIdleCallback(
() => {
const mark = 'onMessageCallback';
performance.mark();
client.onMessage(payload.data);
this.logger.trackTimeSince(mark);
},
{
timeout: 500,
}),
},
),
};
if (conn) {