fix: add timewait

This commit is contained in:
dettlaff 2023-06-26 23:33:41 +04:00
parent 993ea93ee4
commit 19005158a8

View file

@ -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)
if percent - prev_progress >= 5:
Jobs.update( Jobs.update(
job=job, job=job,
status=JobStatus.RUNNING, status=JobStatus.RUNNING,
progress=percent, progress=percent,
status_text="Cleaning...", 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)