diff options
author | Adriaan de Groot <groot@kde.org> | 2020-04-06 17:08:27 +0200 |
---|---|---|
committer | Adriaan de Groot <groot@kde.org> | 2020-04-06 17:08:27 +0200 |
commit | bea41465e273cd945b6f59a6be8b835786c85f3d (patch) | |
tree | 2905d183a9ed2e1c68518a897645288d391a8c17 | |
parent | facf5af589d0c9f60270929715f7cefb905d5ae1 (diff) |
[unpackfs] Update progress around every 1%
-rw-r--r-- | src/modules/unpackfs/main.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index 50ee5b1a0..a82cab61e 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -202,6 +202,9 @@ def file_copy(source, entry, progress_cb): # last_num_files_copied trails num_files_copied, and whenever at least 100 more # files have been copied, progress is reported and last_num_files_copied is updated. last_num_files_copied = 0 + file_count_chunk = entry.total / 100 + if file_count_chunk < 100: + file_count_chunk = 100 for line in iter(process.stdout.readline, b''): # rsync outputs progress in parentheses. Each line will have an @@ -226,8 +229,8 @@ def file_copy(source, entry, progress_cb): # adjusting the offset so that progressbar can be continuesly drawn num_files_copied = num_files_total_local - num_files_remaining - # I guess we're updating every 100 files... - if num_files_copied - last_num_files_copied >= 100: + # Update about once every 1% of this entry + if num_files_copied - last_num_files_copied >= file_count_chunk: last_num_files_copied = num_files_copied progress_cb(num_files_copied, num_files_total_local) |