If the filter is set to FileClosedEvent, the mask is set to InotifyConstants.IN_CLOSE which includes IN_CLOSE_WRITE and IN_CLOSE_NOWRITE, but only IN_CLOSE_WRITE will call on_closed(). I think line 236 should be modified to event_mask |= InotifyConstants.IN_CLOSE_WRITE to improve performance and maintain logical consistency in the code.
|
elif cls is FileClosedEvent: |
|
event_mask |= InotifyConstants.IN_CLOSE |
|
elif event.is_close_write and not event.is_directory: |
|
cls = FileClosedEvent |
|
self.queue_event(cls(src_path)) |
|
self.queue_event(DirModifiedEvent(os.path.dirname(src_path))) |
|
elif event.is_open and not event.is_directory: |
|
cls = FileOpenedEvent |
|
self.queue_event(cls(src_path)) |
|
# elif event.is_close_nowrite and not event.is_directory: |
|
# cls = FileClosedEvent |
|
# self.queue_event(cls(src_path)) |
If the filter is set to
FileClosedEvent, the mask is set toInotifyConstants.IN_CLOSEwhich includesIN_CLOSE_WRITEandIN_CLOSE_NOWRITE, but onlyIN_CLOSE_WRITEwill callon_closed(). I think line 236 should be modified toevent_mask |= InotifyConstants.IN_CLOSE_WRITEto improve performance and maintain logical consistency in the code.watchdog/src/watchdog/observers/inotify.py
Lines 235 to 236 in 9f23b59
watchdog/src/watchdog/observers/inotify.py
Lines 190 to 199 in 9f23b59