From 3bfa67663a10c9b98cab867be21af7146e972b55 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Tue, 6 Sep 2016 12:27:30 +0100 Subject: [PATCH] Fall back to polling if watchdog thread dies --- monitor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/monitor.py b/monitor.py index 5625a840..55db5d7c 100644 --- a/monitor.py +++ b/monitor.py @@ -222,6 +222,9 @@ class EDLogs(FileSystemEventHandler): else: loghandle = None + # Watchdog thread + emitter = self.observed and self.observer._emitter_for_watch[self.observed] # Note: Uses undocumented attribute + while True: if docked and not updated and not config.getint('output') & config.OUT_MKT_MANUAL: @@ -231,7 +234,7 @@ class EDLogs(FileSystemEventHandler): print "%s :\t%s %s" % ('Updated', docked and " docked" or "!docked", updated and " updated" or "!updated") # Check whether new log file started, e.g. client (re)started. - if self.observed: + if emitter and emitter.is_alive(): newlogfile = self.logfile # updated by on_created watchdog callback else: # Poll