1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-16 09:10:35 +03:00

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 2021-01-08 14:25:49 +00:00
parent f3e87f9c24
commit 95b87f5b7b

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')