From 9f4cf0a8e18d2d164d5857c4f85325166afddfa4 Mon Sep 17 00:00:00 2001 From: Ben Muthalaly <benmuthalaly@gmail.com> Date: Mon, 3 Feb 2025 02:47:33 -0600 Subject: [PATCH 1/2] Kill the timer process if it doesn't properly terminate. --- archivebox/misc/logging_util.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/archivebox/misc/logging_util.py b/archivebox/misc/logging_util.py index 6b161b5c..42c85845 100644 --- a/archivebox/misc/logging_util.py +++ b/archivebox/misc/logging_util.py @@ -152,6 +152,11 @@ class TimedProgress: except BaseException: # lgtm [py/catch-base-exception] pass self.p.terminate() + time.sleep(0.1) + # sometimes the timer doesn't terminate properly, then blocks at the join until + # the full time has elapsed. sending a kill tries to avoid that. + if self.p.is_alive(): + self.p.kill() self.p.join() From 71c02ca4ebef208dc823437c0f9a56816b4141e5 Mon Sep 17 00:00:00 2001 From: Ben Muthalaly <benmuthalaly@gmail.com> Date: Wed, 5 Feb 2025 17:55:45 -0600 Subject: [PATCH 2/2] Update archivebox/misc/logging_util.py Co-authored-by: Nick Sweeting <git@sweeting.me> --- archivebox/misc/logging_util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archivebox/misc/logging_util.py b/archivebox/misc/logging_util.py index 42c85845..ef162dd4 100644 --- a/archivebox/misc/logging_util.py +++ b/archivebox/misc/logging_util.py @@ -155,9 +155,10 @@ class TimedProgress: time.sleep(0.1) # sometimes the timer doesn't terminate properly, then blocks at the join until # the full time has elapsed. sending a kill tries to avoid that. - if self.p.is_alive(): + try: self.p.kill() - self.p.join() + except Exception: + pass # clear whole terminal line