mirror of
https://github.com/ankitects/anki.git
synced 2025-11-21 03:57:14 -05:00
fix media trash throttling; decrease delay
This commit is contained in:
parent
db3ce467a3
commit
dcfc6d73a2
1 changed files with 4 additions and 3 deletions
|
|
@ -173,13 +173,13 @@ class MediaChecker:
|
||||||
total = len(fnames)
|
total = len(fnames)
|
||||||
|
|
||||||
def trash(col: Collection) -> None:
|
def trash(col: Collection) -> None:
|
||||||
last_progress = time.time()
|
last_progress = 0.0
|
||||||
remaining = len(fnames)
|
remaining = total
|
||||||
|
|
||||||
for chunk in chunked_list(fnames, 25):
|
for chunk in chunked_list(fnames, 25):
|
||||||
col.media.trash_files(chunk)
|
col.media.trash_files(chunk)
|
||||||
remaining -= len(chunk)
|
remaining -= len(chunk)
|
||||||
if time.time() - last_progress >= 0.3:
|
if time.time() - last_progress >= 0.1:
|
||||||
self.mw.taskman.run_on_main(
|
self.mw.taskman.run_on_main(
|
||||||
lambda: self.mw.progress.update(
|
lambda: self.mw.progress.update(
|
||||||
label=tr.media_check_files_remaining(count=remaining),
|
label=tr.media_check_files_remaining(count=remaining),
|
||||||
|
|
@ -187,6 +187,7 @@ class MediaChecker:
|
||||||
max=total,
|
max=total,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
last_progress = time.time()
|
||||||
|
|
||||||
QueryOp(
|
QueryOp(
|
||||||
parent=aqt.mw,
|
parent=aqt.mw,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue