mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Use _stop_event consistently across all threads as the way to signal that it should stop. Add thread joins with timeouts to allow the program to exit cleanly
This commit is contained in:
@@ -34,6 +34,10 @@ class CleanupTimer:
|
||||
"""Stop any threads and prepare for application shutdown"""
|
||||
|
||||
self._stop_event.set()
|
||||
if self._thread:
|
||||
self._thread.join(timeout=15)
|
||||
if self._thread.is_alive():
|
||||
logger.warning("Cleanup worker thread did not exit on time and will be killed.")
|
||||
|
||||
def _run(self):
|
||||
while not self._stop_event.wait(timeout=self._cleanup_interval):
|
||||
|
||||
Reference in New Issue
Block a user