fix thread stop #180
@@ -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.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user