Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On created event not correctly handled on linux #76

Open
eviweb opened this issue Mar 27, 2019 · 4 comments
Open

On created event not correctly handled on linux #76

eviweb opened this issue Mar 27, 2019 · 4 comments
Labels

Comments

@eviweb
Copy link
Contributor

eviweb commented Mar 27, 2019

Hi,
the following code taken from the on_created event handler:

if self.observer.__class__.__name__ == 'InotifyObserver':
            # inotify also generates modified events for created files
            return

prevents the on_change method to be called on on_created events.

This appears more as a semantic issue as the on_modified handler seems to do the job for now.
But just partially in fact, because this is the source of the issue #68.
And it would take more importance regarding the issue #58 which implies to distinguish event types.
I think being able to propose an alternative soon.
best regards

@joh
Copy link
Owner

joh commented Mar 27, 2019

Ah yes, the issue with inotify is that it generates multiple events for something we want to handle as one event. It would be good to map out exactly which events are triggered for what situations (file creation, file moved to directory, file modified, file deleted, etc). I'm fairly certain the behavior is different across platforms as well. I don't think watchdog is completely platform agnostic...

@eviweb
Copy link
Contributor Author

eviweb commented Mar 27, 2019

I think it's possible to deal with this issue by keeping track of the last event type.
I prefer working on this once the PR #75 will be merged as it adds a new event handler.

eviweb added a commit to eviweb/when-changed that referenced this issue Mar 27, 2019
Keep track of the last event to prevent a created event to be followed by a modified event.
Take care of the `on_change` method signature that takes an optional `event` argument.

Signed-off-by: Eric Villard <[email protected]>
@eviweb
Copy link
Contributor Author

eviweb commented Mar 27, 2019

addressed by #77

@eviweb
Copy link
Contributor Author

eviweb commented Mar 27, 2019

Better choice I think, please see my comment here: #77 (comment)

@joh joh added the bug label Mar 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants