fix references to notifier

This commit is contained in:
David Stainton 2015-07-08 13:13:49 -07:00 committed by Daira Hopwood
parent 4e714179f9
commit 4b049fca56
2 changed files with 16 additions and 9 deletions

View File

@ -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)

View File

@ -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?