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

lose IN_CLOSE_WRITE event #91

Closed
zhaochunqi opened this issue Feb 3, 2015 · 1 comment
Closed

lose IN_CLOSE_WRITE event #91

zhaochunqi opened this issue Feb 3, 2015 · 1 comment

Comments

@zhaochunqi
Copy link

Hi,
I've tried watch IN_CLOSE_WRITE event for my new files .
It works pretty good when I watch IN_CLOSE_WRITE only, when I watch IN_CREATE and IN_CLOSE_WRITE , it will lose lot's of IN_CLOSE_WRITE event .

gif image

It dosen't work when I import pyinotify either. I bugs me a lot.Hope you give me some advice.

@seb-m
Copy link
Owner

seb-m commented Feb 6, 2015

Hello,

Ok, what happens is you experience both this issue #2 and the effects of its mitigation.

Concretely when you copy and attempt to automatically watch a directory 01/ with multiples sub-directories there is a kind of concurrency issue between the moment files are copied and the moment when watches are added, that means for instance that if 01/01/* files are copied and then the 01/02/ directory is created, by the time Pyinotify has processed the events related to 01/01 there are some chances that 01/02 will already be created and its files copied. Because there is nothing we can really do to completely fix this issue, it was decided in #2 that the least bad behavior was to generate IN_CREATE for simulating creation of files contained in 01/02 because we know that this directory is new therefore its files are new, this is why you observe IN_CREATE events. However, others events are not simulated because we can't be sure that a file was either closed after a write or without a write for instance.

So in short, there is nothing we can't really do in this case and you can only rely on IN_CREATE events. Also if you really want to avoid this issue when you copy a directory, then you have to make sure it doesn't contain other directories.

@seb-m seb-m closed this as completed Feb 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants