From: Daira Hopwood <daira@jacaranda.org>
Date: Fri, 30 Oct 2015 02:04:30 +0000 (+0000)
Subject: Don't add subdirectory watches if the platform's notifier doesn't require them. refs... 
X-Git-Url: https://git.rkrishnan.org/specifications/components?a=commitdiff_plain;h=e1bc36f16c9189d41b06740d1509479109be929c;p=tahoe-lafs%2Ftahoe-lafs.git

Don't add subdirectory watches if the platform's notifier doesn't require them. refs #2559

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---

diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py
index b216294b..62daae8c 100644
--- a/src/allmydata/frontends/magic_folder.py
+++ b/src/allmydata/frontends/magic_folder.py
@@ -351,7 +351,9 @@ class Uploader(QueueMixin):
                 self.warn("WARNING: cannot upload symlink %s" % quote_filepath(fp))
                 return None
             elif pathinfo.isdir:
-                self._notifier.watch(fp, mask=self.mask, callbacks=[self._notify], recursive=True)
+                if not getattr(self._notifier, 'recursive_includes_new_subdirectories', False):
+                    self._notifier.watch(fp, mask=self.mask, callbacks=[self._notify], recursive=True)
+
                 uploadable = Data("", self._client.convergence)
                 encoded_path_u += magicpath.path2magic(u"/")
                 upload_d = self._upload_dirnode.add_file(encoded_path_u, uploadable, metadata={"version":0}, overwrite=True)
diff --git a/src/allmydata/windows/inotify.py b/src/allmydata/windows/inotify.py
index bcbc241f..4e7bc904 100644
--- a/src/allmydata/windows/inotify.py
+++ b/src/allmydata/windows/inotify.py
@@ -201,6 +201,7 @@ class INotify(PollMixin):
         self._path = None
         self._pending = set()
         self._pending_delay = 1.0
+        self.recursive_includes_new_subdirectories = True
 
     def set_pending_delay(self, delay):
         self._pending_delay = delay