From 439565e3a378ed891c03efb0ac181cf9509c99fc Mon Sep 17 00:00:00 2001 From: Sebastien Martini Date: Thu, 7 Jun 2012 00:11:35 +0200 Subject: Don't check for existing watch when setting up watches This check had prohibitive cost and was useless to some extent because adding a watch for an already watched path will result in assigning the same watch descriptor therefore only updating it. There won't be any dangling watch descriptor left into the watch manager dictionary. Issue reported by Jan Knudsen https://github.com/Shne --- python2/pyinotify.py | 5 ----- python3/pyinotify.py | 5 ----- 2 files changed, 10 deletions(-) diff --git a/python2/pyinotify.py b/python2/pyinotify.py index cb562c5..ce0d781 100755 --- a/python2/pyinotify.py +++ b/python2/pyinotify.py @@ -1852,11 +1852,6 @@ class WatchManager: for apath in self.__glob(npath, do_glob): # recursively list subdirs according to rec param for rpath in self.__walk_rec(apath, rec): - if self.get_wd(rpath) is not None: - # We decide to ignore paths already inserted into - # the watch manager. Need to be removed with rm_watch() - # first. Or simply call update_watch() to update it. - continue if not exclude_filter(rpath): wd = ret_[rpath] = self.__add_watch(rpath, mask, proc_fun, diff --git a/python3/pyinotify.py b/python3/pyinotify.py index 8d27c1c..bb33c19 100755 --- a/python3/pyinotify.py +++ b/python3/pyinotify.py @@ -1839,11 +1839,6 @@ class WatchManager: for apath in self.__glob(npath, do_glob): # recursively list subdirs according to rec param for rpath in self.__walk_rec(apath, rec): - if self.get_wd(rpath) is not None: - # We decide to ignore paths already inserted into - # the watch manager. Need to be removed with rm_watch() - # first. Or simply call update_watch() to update it. - continue if not exclude_filter(rpath): wd = ret_[rpath] = self.__add_watch(rpath, mask, proc_fun, -- cgit v1.2.1