Revert "Insert context keys before compiling UI scripts (#4372)" (#4373)

This reverts commit 6e6f000800.

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
jimtng 2024-09-10 15:52:16 +10:00 committed by GitHub
parent 53889cdcdb
commit 83b069d970
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,7 +105,6 @@ public abstract class AbstractScriptModuleHandler<T extends Module> extends Base
ScriptEngine scriptEngine = engine.get();
if (scriptEngine instanceof Compilable) {
logger.debug("Pre-compiling script of rule with UID '{}'", ruleUID);
setExecutionContext(scriptEngine, Map.of()); // JRuby script engine needs this before compiling
compiledScript = Optional.ofNullable(((Compilable) scriptEngine).compile(script));
}
}
@ -212,7 +211,7 @@ public abstract class AbstractScriptModuleHandler<T extends Module> extends Base
try {
if (compiledScript.isPresent()) {
logger.debug("Executing pre-compiled script of rule with UID '{}'", ruleUID);
return compiledScript.get().eval();
return compiledScript.get().eval(engine.getContext());
}
logger.debug("Executing script of rule with UID '{}'", ruleUID);
return engine.eval(script);