From b41597ec71b67aad99e59a2826902ab6770ebf84 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 25 Jan 2021 14:18:44 -0800 Subject: [PATCH] Call callback_progress before the byte limiter sleeps. --- voussoirkit/spinal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voussoirkit/spinal.py b/voussoirkit/spinal.py index d936c7c..d63b88b 100644 --- a/voussoirkit/spinal.py +++ b/voussoirkit/spinal.py @@ -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)