You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes this is a bit dirty because the report is now generated once at the
beginning of a command which could be considered a side effect (but
normally treeshaking will only include it only if needed), but the whole
process.report is a weirdly built API meant for debugging and not really
meant to be used in a normal program
But somehow when the call is done in the beginning of the process, this
call is very fast, but when it's called after having run a http request
(as is currently the case, a single call takes a lot more time to
complete, it takes 40s or more on my system when called at the end of
npm upgrade) but only a few milliseconds when called at the beginning
(this is why it's best to run it outside the function at the beginning
of the process as a side effect instead of calling getReport on demand
and cache the result)
Here is a log of console.time('report') and console.timeEnd('report')
before and after the getReport call
when run in the end of the upgrade command:
⠼report: 3:10.573 (m:ss.mmm)
when run in the beginning of the process at the top level
report: 1.943ms
This fixes npm hanging npm/cli#4028,
npm/cli#7814,
npm/cli#7868
0 commit comments