fix: throttle progress (#6867)

Related: https://github.com/teambit/bit/pull/7703
This commit is contained in:
Zoltan Kochan
2023-07-26 16:37:41 +03:00
committed by GitHub
parent dac59e6321
commit 25396e3c5a
2 changed files with 9 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/default-reporter": patch
---
When progress is throttled, the last stats should be printed, when importing is done.

View File

@@ -53,16 +53,16 @@ function throttledProgressOutput (
importingDone$: Rx.Observable<boolean>,
progress$: Rx.Observable<ProgressStats>
) {
let combinedProgress = Rx.combineLatest(
if (throttle != null) {
progress$ = progress$.pipe(throttle)
}
const combinedProgress = Rx.combineLatest(
progress$,
importingDone$
)
// Avoid logs after all resolved packages were downloaded.
// Fixing issue: https://github.com/pnpm/pnpm/issues/1028#issuecomment-364782901
.pipe(takeWhile(([, importingDone]) => !importingDone, true))
if (throttle != null) {
combinedProgress = combinedProgress.pipe(throttle)
}
return combinedProgress.pipe(map(createStatusMessage))
}