fix thread stop #180

Merged
holler merged 1 commits from webpage_fix_thread_stop into main 2026-03-30 14:44:15 +02:00
@@ -403,6 +403,8 @@ class LocalHttpServer:
class _QuietHandler(http.server.SimpleHTTPRequestHandler):
def log_message(self, *args):
pass
def handle_error(self, request, client_address):
pass # suppress BrokenPipeError and other per-connection noise
def start(self) -> None:
Handler = functools.partial(
@@ -547,8 +549,12 @@ class WebpageGeneratorBase:
self._stop_event.set()
if self._thread is not None:
self._thread.join(timeout=self._cycle_interval + 5)
# Always clear the reference so start() gets a clean slate,
# even if the thread did not exit within the join timeout.
self._thread = None
if self._local_server is not None:
self._local_server.stop()
self._local_server = None
self._release_lock()
self._log(VERBOSITY_NORMAL, "WebpageGenerator stopped.")