Remove each progress bar immediately upon completion #1814
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The overall effect of this PR is to make it so that the client displays progress bars only for "in progress" and "recently completed" transfers. For large, recursive transfers and syncs, this:
Prevents noisy scrollback buffers.
Bounds the number of progress bars being displayed to something closer to the number of worker threads and not the total number of objects being transferred, which in turn reduces the number of progress bars that must be removed from the terminal's display when the client exits.
To achieve this:
When each progress bar is created, we configure it to be removed when its "completed" event is triggered.
We enable each progress bar to trigger a "completed" event when we set its total size. (Because each progress bar was originally created with a size of zero, they will not trigger a "completed" event otherwise.)
And for good measure:
I reduced the frequency of updates. Every half-second is more than enough to give a feeling of real-time updates.
I'm letting the deferred
progressCtr.Wait()
handle any clean up, rather thanWait()
ing on each progress bar one at a time.