don't do callbacks if we don't have any
authormeejah <meejah@meejah.ca>
Tue, 8 Dec 2015 16:24:05 +0000 (08:24 -0800)
committerDaira Hopwood <daira@jacaranda.org>
Thu, 14 Jan 2016 17:27:07 +0000 (17:27 +0000)
src/allmydata/windows/inotify.py

index 4e7bc90492c9a263f5e9008cb0813816e762db96..71d0f34e6e11e3e3a7109bec5a9bfadbe382735a 100644 (file)
@@ -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: