From: David Stainton Date: Wed, 8 Jul 2015 20:13:49 +0000 (-0700) Subject: fix references to notifier X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/module-simplejson.decoder.html?a=commitdiff_plain;h=dcf851bf614f2771823057200fd0b5647c0cefbf;p=tahoe-lafs%2Ftahoe-lafs.git fix references to notifier --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index e68580c2..6eba9cc4 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -95,7 +95,9 @@ class MagicFolder(service.MultiService): self._ignore_count = 0 self._download_ignore_count = 0 - self._notifier = inotify.INotify() + # XXX correct? + self._notifier = self._inotify.INotify() + if hasattr(self._notifier, 'set_pending_delay'): self._notifier.set_pending_delay(pending_delay) @@ -104,11 +106,11 @@ class MagicFolder(service.MultiService): # be an IN_CLOSE_WRITE after an IN_CREATE (I think). # TODO: what about IN_MOVE_SELF, IN_MOVED_FROM, or IN_UNMOUNT? # - self.mask = ( inotify.IN_CLOSE_WRITE - | inotify.IN_MOVED_TO - | inotify.IN_MOVED_FROM - | inotify.IN_DELETE - | inotify.IN_ONLYDIR + self.mask = ( self._inotify.IN_CLOSE_WRITE + | self._inotify.IN_MOVED_TO + | self._inotify.IN_MOVED_FROM + | self._inotify.IN_DELETE + | self._inotify.IN_ONLYDIR | IN_EXCL_UNLINK ) self._notifier.watch(self._local_path, mask=self.mask, callbacks=[self._notify], @@ -439,5 +441,5 @@ class MagicFolder(service.MultiService): def _log(self, msg): self._client.log("drop-upload: " + msg) - #print "_log %s" % (msg,) + print "_log %s" % (msg,) #open("events", "ab+").write(msg) diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index 82fa236a..21cacc13 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -221,18 +221,24 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0)) def restart(ignore): + print "restart" tahoe_config_file = os.path.join(self.get_clientdir(), "tahoe.cfg") tahoe_config = fileutil.read(tahoe_config_file) d3 = defer.succeed(None) def write_config(client_node_dir): + print "write_config" fileutil.write(os.path.join(client_node_dir, "tahoe.cfg"), tahoe_config) def setup_stats(result): + print "setup_stats" + self.client = None self.set_up_grid(client_config_hooks={0: write_config}) self.client = self.g.clients[0] self.stats_provider = self.client.stats_provider + self.magicfolder = self.client.getServiceNamed("magic-folder") + d3.addBoth(self.cleanup) d3.addCallback(setup_stats) - d3.addCallback(self._create_magicfolder) + #d3.addCallback(self._create_magicfolder) return d3 d.addCallback(restart) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_succeeded'), 0)) @@ -280,7 +286,6 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual previously_uploaded = self._get_count('magic_folder.objects_succeeded') previously_disappeared = self._get_count('magic_folder.objects_disappeared') - d = defer.Deferred() # Note: this relies on the fact that we only get one IN_CLOSE_WRITE notification per file # (otherwise we would get a defer.AlreadyCalledError). Should we be relying on that?