Skip to content
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

[rules] Don't attempt to pre-compile disabled rules #4329

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1555,15 +1555,16 @@ public void onReadyMarkerRemoved(ReadyMarker readyMarker) {
}

/**
* This method compiles the conditions and actions of all rules. It is called when the rule engine is started.
* This method compiles the conditions and actions of all enabled rules.
* It is called when the rule engine is started.
* By compiling when the rule engine is started, we make sure all conditions and actions are compiled, even if their
* handlers weren't available when the rule was added to the rule engine.
*/
private void compileRules() {
getScheduledExecutor().submit(() -> {
ruleRegistry.getAll().forEach(r -> {
compileRule(r.getUID());
});
ruleRegistry.getAll().stream() //
.filter(r -> isEnabled(r.getUID())) //
.forEach(r -> compileRule(r.getUID()));
executeRulesWithStartLevel();
});
}
Expand Down