performance.timerify(fn) behave inconsistently for sync/async functions #42743
Labels
confirmed-bug
Issues with confirmed bugs.
perf_hooks
Issues and PRs related to the implementation of the Performance Timing API.
Version
master branch
Platform
All
Subsystem
perf_hooks
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Timerified functions should behave consistently for whether trigger
histogram.record
.What do you see instead?
Currently, normal function would not trigger
histogram.record
if throw; but async function (or any function which return promise) would.Additional information
Currently, the code is like
if (typeof result?.finally === 'function') return result.finally(...)
. It should useresult.then
instead, so the behavior will consistent with non-thenable result. Even we want to always triggerhistogram.record
, we should not usefinally
because thenable is only require to havethen
method, notfinally
method.The text was updated successfully, but these errors were encountered: