Closed jkawamoto closed 6 years ago
Thank you for your comments. According to the above comments and https://github.com/gmethvin/directory-watcher/issues/10#issuecomment-372015307, I modified the code so that it uses pathHashes
to prevent sending duplicate creation events.
@jkawamoto There is still a duplicate directory create event: https://ci.appveyor.com/project/gmethvin/directory-watcher/build/108#L1121.
That's because for CREATE events we don't check hashes and always call onEvent
: https://github.com/gmethvin/directory-watcher/blob/v0.4.0/core/src/main/java/io/methvin/watcher/DirectoryWatcher.java#L152.
For it to work we need to always check that the hash doesn't exist before emitting the event, even for directories.
I modified the code so that it checks if a creation event has been notified. So far, tests passed in Windows and macOS. For Linux, I need more investigation.
It looks like a flaky test. It looks like we are getting a CREATE
then MODIFY
for one.txt
when we were expecting just a CREATE
. That is probably fine though, since the FileSystem#create
method is writing some data to the file when it creates the file, so from the filesystem's point of view the file is being "modified". Just a guess but it might help to change FileSystem#create(path)
to write an empty file rather than writing the path.
That's true. It should be same as one in notifyCreateEvent
. I refactored them so that notifyCreateEvent can be used by both.
Thank you for the comment. I modified it.
I released version 0.5.1 with this change.
I appreciate it.
This PR fixes #10.