convert _notify
This commit is contained in:
parent
bfb039c6c6
commit
c3e50a4536
|
@ -685,6 +685,12 @@ SCAN = ActionType(
|
||||||
u"A brute-force scan of a subset of the local directory is being performed.",
|
u"A brute-force scan of a subset of the local directory is being performed.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
NOTIFIED = ActionType(
|
||||||
|
u"magic-folder:notified",
|
||||||
|
[PATH, _NICKNAME, _DIRECTION],
|
||||||
|
[],
|
||||||
|
u"Magic-Folder received a notification of a local filesystem change for a certain path.",
|
||||||
|
)
|
||||||
|
|
||||||
class QueueMixin(HookMixin):
|
class QueueMixin(HookMixin):
|
||||||
"""
|
"""
|
||||||
|
@ -1080,13 +1086,11 @@ class Uploader(QueueMixin):
|
||||||
return relpath_u in self._pending
|
return relpath_u in self._pending
|
||||||
|
|
||||||
def _notify(self, opaque, path, events_mask):
|
def _notify(self, opaque, path, events_mask):
|
||||||
# Twisted doesn't seem to do anything if our callback throws
|
with NOTIFIED(path=path, **self._log_fields):
|
||||||
# an error, so...
|
try:
|
||||||
try:
|
return self._real_notify(opaque, path, events_mask)
|
||||||
return self._real_notify(opaque, path, events_mask)
|
except Exception:
|
||||||
except Exception as e:
|
write_traceback()
|
||||||
self._log(u"error calling _real_notify: {}".format(e))
|
|
||||||
twlog.err(Failure(), "Error calling _real_notify")
|
|
||||||
|
|
||||||
def _real_notify(self, opaque, path, events_mask):
|
def _real_notify(self, opaque, path, events_mask):
|
||||||
self._log("inotify event %r, %r, %r\n" % (opaque, path, ', '.join(self._inotify.humanReadableMask(events_mask))))
|
self._log("inotify event %r, %r, %r\n" % (opaque, path, ', '.join(self._inotify.humanReadableMask(events_mask))))
|
||||||
|
|
|
@ -1789,7 +1789,8 @@ class SingleMagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, Reall
|
||||||
# pending callbacks including the exception are processed
|
# pending callbacks including the exception are processed
|
||||||
# before we flush the errors.
|
# before we flush the errors.
|
||||||
yield task.deferLater(reactor, 0, lambda: None)
|
yield task.deferLater(reactor, 0, lambda: None)
|
||||||
errors = self.flushLoggedErrors(BadStuff)
|
|
||||||
|
errors = self.eliot_logger.flushTracebacks(BadStuff)
|
||||||
# it seems on Windows the "RealTest" variant only produces 1
|
# it seems on Windows the "RealTest" variant only produces 1
|
||||||
# notification for some reason..
|
# notification for some reason..
|
||||||
self.assertTrue(len(errors) >= 1)
|
self.assertTrue(len(errors) >= 1)
|
||||||
|
|
Loading…
Reference in New Issue