Skip to content
Permalink
Browse files

perf_hooks: import http2 only once

Import http2 internal bindings on each collectHttp2Stats call is not
required.

PR-URL: #29419
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
  • Loading branch information...
fanatid authored and Trott committed Sep 3, 2019
1 parent c6b7e74 commit 618630265451dedf0bfda832cd8094b60276769a
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/perf_hooks.js
@@ -92,11 +92,12 @@ const IDX_SESSION_STATS_DATA_SENT = 6;
const IDX_SESSION_STATS_DATA_RECEIVED = 7;
const IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS = 8;

let http2;
let sessionStats;
let streamStats;

function collectHttp2Stats(entry) {
const http2 = internalBinding('http2');
if (http2 === undefined) http2 = internalBinding('http2');
switch (entry.name) {
case 'Http2Stream':
if (streamStats === undefined)

0 comments on commit 6186302

Please sign in to comment.
You can’t perform that action at this time.