Skip to content

Commit

Permalink
#160: fix progressbar values
Browse files Browse the repository at this point in the history
  • Loading branch information
abbbi committed Mar 19, 2024
1 parent 3f30a3a commit 3451ed1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 2.1
---------
* Fix Progressbar: Since change for issue #133 the Progressbar was
updated with wrong values and as result progressed too fast for the amount of
data actually written.

Version 2.0
---------
* Update README
Expand Down
4 changes: 2 additions & 2 deletions libvirtnbdbackup/backup/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def backup( # pylint: disable=too-many-arguments,too-many-branches, too-many-lo
if streamType == "raw":
size = writer.seek(save.offset)

progressBar.update(save.length)

if streamType == "stream":
writer.write(sTypes.TERM)
if args.compress:
Expand All @@ -181,8 +183,6 @@ def backup( # pylint: disable=too-many-arguments,too-many-branches, too-many-lo
compressedSizes.append(size)
else:
assert size == save.length

progressBar.update(save.length)
else:
if streamType == "raw":
writer.seek(save.offset)
Expand Down
2 changes: 1 addition & 1 deletion libvirtnbdbackup/chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def write(
else:
wSize += writer.write(data)

pbar.update(wSize)
pbar.update(blocklen)

return wSize, cSizes

Expand Down
1 change: 1 addition & 0 deletions libvirtnbdbackup/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def progressBar(total: int, desc: str, args: Namespace, count=0) -> tqdm:
desc=desc,
unit="B",
unit_scale=True,
unit_divisor=1000,
disable=args.noprogress,
position=count,
leave=False,
Expand Down

0 comments on commit 3451ed1

Please sign in to comment.