From 5b9c92caccfb79eae30ea487b9c0a175cdefa8fe Mon Sep 17 00:00:00 2001 From: meejah <meejah@meejah.ca> Date: Tue, 8 Dec 2015 08:24:05 -0800 Subject: [PATCH] don't do callbacks if we don't have any --- src/allmydata/windows/inotify.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/allmydata/windows/inotify.py b/src/allmydata/windows/inotify.py index 4e7bc904..71d0f34e 100644 --- a/src/allmydata/windows/inotify.py +++ b/src/allmydata/windows/inotify.py @@ -272,11 +272,12 @@ class INotify(PollMixin): self._pending.add(path) def _do_callbacks(): self._pending.remove(path) - for cb in self._callbacks: - try: - cb(None, path, IN_CHANGED) - except Exception, e: - log.err(e) + if self._callbacks: + for cb in self._callbacks: + try: + cb(None, path, IN_CHANGED) + except Exception, e: + log.err(e) reactor.callLater(self._pending_delay, _do_callbacks) reactor.callFromThread(_maybe_notify, path) except Exception, e: -- 2.45.2