Rules/Sitemaps/Scripts refreshed twice #4824
Comments
The framework gets these events from the JVM, and the JVM gets them from the OS/FileSystem more or less directly. I have seen this a couple of times and apparently factors like OS, files system, remote access method and used editor have an influence of this. I was thinking already of adding a grace period in FolderObserver, i.e. only load/refresh models after there hasn't been any such event for a certain amount of time (e.g. one or very few seconds). |
...in order to skip duplicate file system events or intermediate states where the file technically is empty for a very short moment. fixes eclipse-archived#4824 Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
...in order to skip duplicate file system events or intermediate states where the file technically is empty for a very short moment. fixes eclipse-archived#4824 Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
...in order to skip duplicate file system events or intermediate states where the file technically is empty for a very short moment. fixes eclipse-archived#4824 Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
* delay processing of model files ...in order to skip duplicate file system events or intermediate states where the file technically is empty for a very short moment. fixes #4824 Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
* delay processing of model files ...in order to skip duplicate file system events or intermediate states where the file technically is empty for a very short moment. fixes eclipse-archived#4824 Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
@SJKA Thank you very much for implementing this workaround. However, I just found a quirk (I'm unsure if I should open a new issue): Here are two examples:
|
When changing files (rules, scripts, sitemaps), this results in openHAB to Load and Refresh the file twice, causing unnecessary delays especially on embedded platforms.
Expected behaviour
When changing files, the ModelRepositoryImpl should only refresh known files. When a new file is added, it should be added and watched out for changes.
Current behaviour
When changing files (rules, scripts, sitemaps), this results in openHAB to Load and Refresh the file twice, causing unnecessary delays especially on embedded platforms.
Possible solution
None known. Workaround: Stop openhab, change files as needed, start openhab again.
Steps to reproduce
Change a configuration file (rule, sitemap, script) by using any editor. Look at the openhab.log and notice "Loading model XXX", "Refreshing model XXX", "Refreshing model XXX".
My environment
Debian 9.3 on raspberry pi 3 with openhab2 2.2.0-1 stable out of repo.
root@openhab2:~# java -version
openjdk version "1.8.0_152"
OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)
Additional notes
The bug may be caused by one of these places: https://github.com/eclipse/smarthome/blob/36c9e2717e4f89cf60a0d885e7ecc6069b338f48/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/folder/FolderObserver.java#L242
https://github.com/eclipse/smarthome/blob/36c9e2717e4f89cf60a0d885e7ecc6069b338f48/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/ModelRepositoryImpl.java#L91
Also discussed in the community
https://community.openhab.org/t/rules-still-loading-running-twice/22183
The text was updated successfully, but these errors were encountered: