Skip to content

Commit b30c40b

Browse files
fanatidtargos
authored andcommitted
perf_hooks: import http2 only once
Import http2 internal bindings on each collectHttp2Stats call is not required. PR-URL: #29419 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent 844b45b commit b30c40b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/perf_hooks.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ const IDX_SESSION_STATS_DATA_SENT = 6;
9292
const IDX_SESSION_STATS_DATA_RECEIVED = 7;
9393
const IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS = 8;
9494

95+
let http2;
9596
let sessionStats;
9697
let streamStats;
9798

9899
function collectHttp2Stats(entry) {
99-
const http2 = internalBinding('http2');
100+
if (http2 === undefined) http2 = internalBinding('http2');
100101
switch (entry.name) {
101102
case 'Http2Stream':
102103
if (streamStats === undefined)

0 commit comments

Comments
 (0)