8000 Ambiguity in setting FileClosedEvent in filter · Issue #1046 · gorakhargosh/watchdog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Ambiguity in setting FileClosedEvent in filter #1046
Closed
@xieyuguang

Description

@xieyuguang

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))

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0