mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-26 05:51:29 +00:00
fix: add timewait
This commit is contained in:
parent
993ea93ee4
commit
19005158a8
|
@ -47,12 +47,9 @@ def parse_line(line):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def stream_process(
|
def stream_process(job, stream, total_dead_packages):
|
||||||
job,
|
|
||||||
stream,
|
|
||||||
total_dead_packages,
|
|
||||||
):
|
|
||||||
completed_packages = 0
|
completed_packages = 0
|
||||||
|
prev_progress = 0
|
||||||
|
|
||||||
for line in stream:
|
for line in stream:
|
||||||
line = line.decode("utf-8")
|
line = line.decode("utf-8")
|
||||||
|
@ -61,12 +58,14 @@ def stream_process(
|
||||||
completed_packages += 1
|
completed_packages += 1
|
||||||
percent = int((completed_packages / total_dead_packages) * 100)
|
percent = int((completed_packages / total_dead_packages) * 100)
|
||||||
|
|
||||||
Jobs.update(
|
if percent - prev_progress >= 5:
|
||||||
job=job,
|
Jobs.update(
|
||||||
status=JobStatus.RUNNING,
|
job=job,
|
||||||
progress=percent,
|
status=JobStatus.RUNNING,
|
||||||
status_text="Cleaning...",
|
progress=percent,
|
||||||
)
|
status_text="Cleaning...",
|
||||||
|
)
|
||||||
|
prev_progress = percent
|
||||||
|
|
||||||
elif "store paths deleted," in line:
|
elif "store paths deleted," in line:
|
||||||
status = parse_line(line)
|
status = parse_line(line)
|
||||||
|
|
Loading…
Reference in a new issue