From 494b41f4f14a408da92e05374d934c10a4c3adaf Mon Sep 17 00:00:00 2001 From: Rob Thomas Date: Thu, 17 Feb 2022 16:15:05 +1000 Subject: [PATCH] Fix MB/s calculations on multiple transfers --- zfs_autobackup/ZfsNode.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zfs_autobackup/ZfsNode.py b/zfs_autobackup/ZfsNode.py index 5bd9665..7142d0a 100644 --- a/zfs_autobackup/ZfsNode.py +++ b/zfs_autobackup/ZfsNode.py @@ -132,9 +132,15 @@ class ZfsNode(ExecuteNode): # actual useful info if len(progress_fields) >= 3: if progress_fields[0] == 'full' or progress_fields[0] == 'size': + # Reset the total bytes and start the timer again (otherwise the MB/s + # counter gets confused) self._progress_total_bytes = int(progress_fields[2]) + self._progress_start_time = time.time() elif progress_fields[0] == 'incremental': + # Reset the total bytes and start the timer again (otherwise the MB/s + # counter gets confused) self._progress_total_bytes = int(progress_fields[3]) + self._progress_start_time = time.time() elif progress_fields[1].isnumeric(): bytes_ = int(progress_fields[1]) if self._progress_total_bytes: