http_client: modify download progress reporting

Report progress for each percentage change.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-04-21 06:37:52 -04:00
parent f8a38abc89
commit c1eda1ef3d
No known key found for this signature in database
GPG Key ID: 7027245FBBDDF59A
1 changed files with 2 additions and 1 deletions

View File

@ -470,7 +470,8 @@ class StreamingDownload:
self.total_recd += len(chunk)
if self.download_size > 0 and self.progress_callback is not None:
pct = int(self.total_recd / self.download_size * 100 + .5)
if pct - self.pct_done > 5:
pct = min(100, pct)
if pct != self.pct_done:
self.pct_done = pct
self.progress_callback(
pct, self.download_size, self.total_recd)