Skip to content

Commit e157448

Browse files
authored
[rules] Don't attempt to pre-compile disabled rules (#4329)
Fixes an issue, where an error that compilation failed for disabled rules. Reported on the community: https://community.openhab.org/t/oh-4-2-snapshot-disabled-rules-failed-to-compile-error-in-opehab-log/157402. Follow-up for #4289. Signed-off-by: Florian Hotze <[email protected]>
1 parent f502e9d commit e157448

File tree

1 file changed

+5
-4
lines changed
  • bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal

1 file changed

+5
-4
lines changed

bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1555,15 +1555,16 @@ public void onReadyMarkerRemoved(ReadyMarker readyMarker) {
15551555
}
15561556

15571557
/**
1558-
* This method compiles the conditions and actions of all rules. It is called when the rule engine is started.
1558+
* This method compiles the conditions and actions of all enabled rules.
1559+
* It is called when the rule engine is started.
15591560
* By compiling when the rule engine is started, we make sure all conditions and actions are compiled, even if their
15601561
* handlers weren't available when the rule was added to the rule engine.
15611562
*/
15621563
private void compileRules() {
15631564
getScheduledExecutor().submit(() -> {
1564-
ruleRegistry.getAll().forEach(r -> {
1565-
compileRule(r.getUID());
1566-
});
1565+
ruleRegistry.getAll().stream() //
1566+
.filter(r -> isEnabled(r.getUID())) //
1567+
.forEach(r -> compileRule(r.getUID()));
15671568
executeRulesWithStartLevel();
15681569
});
15691570
}

0 commit comments

Comments
 (0)