pyinotify: amend to 1e4a14fb25d88e32f3ca9c06fb1d6b8d3b4813ab: one fix more for sporadic runtime error "dictionary changed size during iteration" (watched files)

pull/3117/head
sebres 2021-09-08 19:56:02 +02:00
parent e323c148e1
commit ba282b794c
1 changed files with 2 additions and 2 deletions

View File

@ -188,7 +188,7 @@ class FilterPyinotify(FileFilter):
self._refreshWatcher(path, isDir=isDir) self._refreshWatcher(path, isDir=isDir)
if isDir: if isDir:
# check all files belong to this dir: # check all files belong to this dir:
for logpath in self.__watchFiles: for logpath in list(self.__watchFiles):
if logpath.startswith(path + pathsep): if logpath.startswith(path + pathsep):
# if still no file - add to pending, otherwise refresh and process: # if still no file - add to pending, otherwise refresh and process:
if not os.path.isfile(logpath): if not os.path.isfile(logpath):
@ -285,7 +285,7 @@ class FilterPyinotify(FileFilter):
logSys.error("Failed to remove watch on path: %s", path) logSys.error("Failed to remove watch on path: %s", path)
path_dir = dirname(path) path_dir = dirname(path)
for k in self.__watchFiles: for k in list(self.__watchFiles):
if k.startswith(path_dir + pathsep): if k.startswith(path_dir + pathsep):
path_dir = None path_dir = None
break break