Comments (7)
Are there specific types of edits that cause that behavior? Did you check if it's the underlying Java watch service that's duplicating the events or if they're generated by directory-watcher itself? (you should be able to see with debug logging enabled)
Depending on how the events are generated, we can probably detect that sequence of events in directory-watcher and compress them into a single MODIFY.
from directory-watcher.
You can see example here: openhab/openhab-core#3400 (comment) (except the last post from myself, that is a bug in our code).
from directory-watcher.
Which platforms have you tested on? Seems like it's either due to a bug in the underlying WatchService implementation or the events the OS itself is reporting.
from directory-watcher.
For @mhilbush it is Ubuntu 22.04 for the samba server and a MacOS client. I'm not sure who actually is the issue here, if it's a faulty behavior of the client or the server.
from directory-watcher.
I also see similar behavior using a Windows client (e.g. Notepad++ on Win 10) and a Linux client (nano on Ubuntu) accessing the same share as with the MacOS client.
2023-02-28 07:18:03.876 [DEBUG] [io.methvin.watcher.DirectoryWatcher ] - ENTRY_MODIFY [/opt/openhab4/conf/rules/zoneminder.rules]
2023-02-28 07:18:03.877 [DEBUG] [io.methvin.watcher.DirectoryWatcher ] - -> MODIFY [/opt/openhab4/conf/rules/zoneminder.rules] (isDirectory: false)
2023-02-28 07:18:03.877 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'zoneminder.rules'
2023-02-28 07:18:03.923 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'zoneminder.rules' is either empty or cannot be parsed correctly!
2023-02-28 07:18:03.923 [DEBUG] [io.methvin.watcher.DirectoryWatcher ] - ENTRY_MODIFY [/opt/openhab4/conf/rules/zoneminder.rules]
2023-02-28 07:18:03.924 [DEBUG] [io.methvin.watcher.DirectoryWatcher ] - -> MODIFY [/opt/openhab4/conf/rules/zoneminder.rules] (isDirectory: false)
2023-02-28 07:18:03.924 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'zoneminder.rules'
Versus saving it locally using e.g. nano.
[2023-02-28 07:39:28.275 [DEBUG] [io.methvin.watcher.DirectoryWatcher ] - ENTRY_MODIFY [/opt/openhab4/conf/rules/zoneminder.rules]
2023-02-28 07:39:28.276 [DEBUG] [io.methvin.watcher.DirectoryWatcher ] - -> MODIFY [/opt/openhab4/conf/rules/zoneminder.rules] (isDirectory: false)
2023-02-28 07:39:28.277 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'zoneminder.rules'
2023-02-28 07:39:29.909 [DEBUG] [io.methvin.watcher.DirectoryWatcher ] - ENTRY_MODIFY [/opt/openhab4/conf/rules/zoneminder.rules]
from directory-watcher.
I am also getting 8 events on one event type . Like a file is deleted then 8 events are fired for it
from directory-watcher.
I likely won't have time to look into this further anytime soon, but I'm happy to accept pull requests if anyone finds a viable way to handle this.
from directory-watcher.
Related Issues (20)
- [JAVA] 0.9.3 Copy & Remove of folder structure does not produce CREATE events HOT 1
- Missing tag `0.9.6` upstream HOT 1
- New Release HOT 4
- Absolute path prevents events on macOS HOT 3
- Question on Using 2 Classes HOT 1
- LibCarbon failure on MacOS Big Sur HOT 12
- Allow watching directory non-recursively HOT 1
- Unable to detect file deletion events HOT 27
- File creation on Windows is sometimes not detected for copied files HOT 3
- Ensure consistent behavior when a root watched directory is deleted
- Define a minimal public API
- Watcher does not detect (re)moving a parent directory HOT 2
- DirectoryWatcher.watch() throws ClosedWatchServiceException when Watcher is closed HOT 4
- Access denied stops walking file tree HOT 7
- Does it work with mounted volumes with Docker? HOT 4
- Missing events when file is created too soon after watcher is initialized HOT 3
- Modification events are lost depending on editor - how the file is written - neovim HOT 7
- Fails with NoClassDefFoundError inside Wildfly HOT 2
- Suggestion: Fail (or handle!) watched path being a file instead of a directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from directory-watcher.