From dcfc6d73a2718330ac60e03ad8d3a7bb3f5aeb83 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 4 Dec 2021 09:09:46 +1000 Subject: [PATCH] fix media trash throttling; decrease delay --- qt/aqt/mediacheck.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qt/aqt/mediacheck.py b/qt/aqt/mediacheck.py index 8252fbe07..740fc9cc3 100644 --- a/qt/aqt/mediacheck.py +++ b/qt/aqt/mediacheck.py @@ -173,13 +173,13 @@ class MediaChecker: total = len(fnames) def trash(col: Collection) -> None: - last_progress = time.time() - remaining = len(fnames) + last_progress = 0.0 + remaining = total for chunk in chunked_list(fnames, 25): col.media.trash_files(chunk) remaining -= len(chunk) - if time.time() - last_progress >= 0.3: + if time.time() - last_progress >= 0.1: self.mw.taskman.run_on_main( lambda: self.mw.progress.update( label=tr.media_check_files_remaining(count=remaining), @@ -187,6 +187,7 @@ class MediaChecker: max=total, ) ) + last_progress = time.time() QueryOp( parent=aqt.mw,