watchdog icon indicating copy to clipboard operation
watchdog copied to clipboard

Ambiguity in setting FileClosedEvent in filter

Open xieyuguang opened this issue 7 months ago • 5 comments

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.

https://github.com/gorakhargosh/watchdog/blob/9f23b599f369cdd873c0cf3dd9e69567234d78fb/src/watchdog/observers/inotify.py#L235-L236

https://github.com/gorakhargosh/watchdog/blob/9f23b599f369cdd873c0cf3dd9e69567234d78fb/src/watchdog/observers/inotify.py#L190-L199

xieyuguang avatar Jul 18 '24 07:07 xieyuguang