-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Improve FolderObserver #4444
base: main
Are you sure you want to change the base?
Improve FolderObserver #4444
Conversation
It has been reported that missing model directories cause issued during startup. With this PR a directory is created when it is missing. Signed-off-by: Jan N. Klug <[email protected]>
Looks good |
No, Not complete |
Is it something we can include in 4.3 or is it still not yet ready? |
Unfortunately I can't remember what is missing. IMO this is an improvement, even if it does not fully solve the issue. IIRC there are some corner-cases where it still does not work. |
@J-N-K I remember that I had seen the discussion in #3823 if this should be solved by creating the missing folders or learn more about the root cause. This is why I did not merge it at that time. So shall we proceed merging this one to improve the situation? |
I have a general question here: The FolderObserver watches folders in the |
Very good remark. |
try { | ||
Path extensionPath = watchService.getWatchPath().resolve(extension); | ||
Files.createDirectories(extensionPath); | ||
} catch (IOException e) { | ||
logger.error("Model path for extension '{}' is missing and creation failed: {}", extension, e.getMessage()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the suggestion is
Path extensionPath = watchService.getWatchPath().resolve(extension);
if (!Files.isDirectory(extensionPath)) {
logger.error("Model path for extension '{}' is missing or not accessible. Please create it and restart openHAB.", extension);
}
Yes some users just copy a few of their directories and think everything else will then magically work. |
I don't fully understand what causes this problem, but as one user explains in #3823:
If no Items files are in use, why must this folder exist? It doesn't seem logical to me, whether it's created or logged, it seems like the real problem is why the lack of this folder causes the system initialization to fail. |
Party fixes #3823
It has been reported that missing model directories cause issued during startup. With this PR a directory is created when it is missing.