From 95b87f5b7b374633ea5be303fdf805f7961fdf16 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 8 Jan 2021 14:25:49 +0000 Subject: [PATCH] monitor: Detect shutdown and bail in log reading loop This should mean not even generating <> Tk events once self.thread == None. --- monitor.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/monitor.py b/monitor.py index 3ecb3a0a..b86a8590 100644 --- a/monitor.py +++ b/monitor.py @@ -327,6 +327,11 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below loghandle.seek(0, SEEK_END) # required to make macOS notice log change over SMB loghandle.seek(log_pos, SEEK_SET) # reset EOF flag # TODO: log_pos reported as possibly unbound for line in loghandle: + # Paranoia check to see if we're shutting down + if threading.current_thread() != self.thread: + logger.info("We're not meant to be running, exiting...") + return # Terminate + if b'"event":"Location"' in line: logger.trace('Found "Location" event, appending to event_queue')