Potential issue with finish_all method ?
vikigenius opened this issue · comments
I was going through the source and found something confusing.
Here is the current finish_all method
dlm/src/progress_bar_manager.rs
Lines 63 to 70 in b5d249c
I am confused. Shouldn't it be max_concurrent_downloads
instead of file_pb_count
? Because at most max_concurrent_downloads
progress bars are being created ?
Hi @vikigenius,
Thank you for checking the source, I remember you from Reddit 👍
I understand why you are confused, the code could be improved.
Currently file_pb_count
is set to max_concurrent_downloads
in ProgressBarManager::init
.
This means dlm
always create max_concurrent_downloads
progress bars eagerly even if the input file contains less entries, which means having progress bars that are never used being displayed.
Ideally we should initialize file_pb_count
with min(max_concurrent_downloads, input_file_len)
.
This would be an easy PR if you want to contribute.
Is this answering your question?
Ah ok that makes sense, sure I will make a PR.