From 6aa3457fb40c69fcbc4479e3672aa45a70a9d6a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Wed, 29 May 2019 08:19:29 -0700 Subject: [PATCH] track onMessage performance Summary: Tracking the time of onMessage callback Reviewed By: passy Differential Revision: D15536546 fbshipit-source-id: 9e93c11555a0a045ef60355ec1d0c6ca7cd49cdd --- src/Client.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Client.js b/src/Client.js index 551287e4a..f9dbfa926 100644 --- a/src/Client.js +++ b/src/Client.js @@ -112,9 +112,17 @@ export default class Client extends EventEmitter { const client = this; this.responder = { fireAndForget: (payload: {data: string}) => - requestIdleCallback(() => client.onMessage(payload.data), { - timeout: 500, - }), + requestIdleCallback( + () => { + const mark = 'onMessageCallback'; + performance.mark(); + client.onMessage(payload.data); + this.logger.trackTimeSince(mark); + }, + { + timeout: 500, + }, + ), }; if (conn) {