Add logging of IN_IGNORED and IN_Q_OVERFLOW. 1431.windows-drop-upload.5
authorDaira Hopwood <daira@jacaranda.org>
Fri, 29 May 2015 20:39:47 +0000 (21:39 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Fri, 29 May 2015 20:39:47 +0000 (21:39 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/drop_upload.py

index 0b658d6f63092b423dec705de1dcb1374781bb1c..f1466f70328301f332615d4e9ca356014c9c75b5 100644 (file)
@@ -193,7 +193,24 @@ class DropUploader(service.MultiService):
 
     def _notify(self, opaque, path, events_mask):
         self._log("inotify event %r, %r, %r\n" % (opaque, path, ', '.join(self._inotify.humanReadableMask(events_mask))))
+
+        # IN_Q_OVERFLOW, IN_IGNORED and IN_UNMOUNT can be sent to any watch.
+
+        if events_mask & IN_Q_OVERFLOW != 0:
+            self.log("queue overflow")
+            # FIXME should rescan
+            return
+
         path_u = unicode_from_filepath(path)
+        if events_mask & IN_IGNORED != 0:
+            if abspath_expanduser_unicode(path_u) == self._local_dir:
+                self.log("watch removed, directory deleted, or filesystem unmounted")
+                # FIXME what to do here?
+            return
+        if events_mask & IN_UNMOUNT != 0:
+            # ignore this; we'll also get an IN_IGNORED event.
+            return
+
         if path_u not in self._pending:
             self._append_to_deque(path_u)