monitor: Detect shutdown and bail in log reading loop

This should mean not even generating <<JournalEvent>> Tk events once
self.thread == None.
This commit is contained in:
Athanasius committed 2021-01-08 14:56:22 +00:00
1 parent f3e87f9c24
commit 95b87f5b7b
1 file changed
+5
+5
View File
@@ -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')