Skip to content

Commit 7eb4b51

Browse files
committed
Avoid closure for onFinish handlers
Change-type: patch
1 parent a20bb5b commit 7eb4b51

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/collectors/api/collect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ export const collectAPIMetrics = (
7777
? 'aborted'
7878
: 'completed';
7979
req._metrics_gatherer.labels.statusCode = res.statusCode || '';
80-
onFinishFuncs.forEach((f) => {
80+
for (const f of onFinishFuncs) {
8181
f();
82-
});
82+
}
8383
});
8484
next();
8585
};

test/api-collector.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ describe('API metrics', () => {
4545
/api_bytes_written_bucket{le="\+Inf",state="completed",statusCode="200"} 1/,
4646
/api_latency_milliseconds_count{state="completed",statusCode="200"} 1/,
4747
];
48-
metricsRegexps.forEach((re) => {
48+
for (const re of metricsRegexps) {
4949
expect(re.test(output)).to.be.true;
50-
});
50+
}
5151
});
5252
});

0 commit comments

Comments
 (0)