Call callback_progress before the byte limiter sleeps.

This commit is contained in:
voussoir 2021-01-25 14:18:44 -08:00
parent 51bbe54f2d
commit b41597ec71
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -501,11 +501,11 @@ def copy_file(
destination_handle.write(data_chunk)
results.written_bytes += data_bytes
callback_progress(destination, results.written_bytes, source_bytes)
if bytes_per_second is not None:
bytes_per_second.limit(data_bytes)
callback_progress(destination, results.written_bytes, source_bytes)
if results.written_bytes == 0:
# For zero-length files, we want to get at least one call in there.
callback_progress(destination, results.written_bytes, source_bytes)