Skip to content

Commit

Permalink
polling: explicitly check if we should stop instead of setting to none
Browse files Browse the repository at this point in the history
  • Loading branch information
tamland committed Feb 13, 2014
1 parent 1e71946 commit 273cc8b
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/watchdog/observers/polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,14 @@ def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
self._snapshot = DirectorySnapshot(watch.path, watch.is_recursive)
self._lock = threading.Lock()

def on_thread_stop(self):
with self._lock:
self._snapshot = None

def queue_events(self, timeout):
# We don't want to hit the disk continuously.
# timeout behaves like an interval for polling emitters.
time.sleep(timeout)

with self._lock:

if not self._snapshot:
if not self.should_keep_running():
return

# Get event diff between fresh snapshot and previous snapshot.
Expand Down

0 comments on commit 273cc8b

Please sign in to comment.