This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch UNOMI-897-groovy-fixes in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/UNOMI-897-groovy-fixes by this push: new d091295b9 Add new error count to prevent from logging errors all the time. d091295b9 is described below commit d091295b906b08ad6fa2ecee9032f9140299a83a Author: Serge Huber <shu...@jahia.com> AuthorDate: Sun Jul 20 07:57:34 2025 +0200 Add new error count to prevent from logging errors all the time. --- .../groovy/actions/services/impl/GroovyActionsServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/groovy-actions/services/src/main/java/org/apache/unomi/groovy/actions/services/impl/GroovyActionsServiceImpl.java b/extensions/groovy-actions/services/src/main/java/org/apache/unomi/groovy/actions/services/impl/GroovyActionsServiceImpl.java index 07f216276..3ad70b69b 100644 --- a/extensions/groovy-actions/services/src/main/java/org/apache/unomi/groovy/actions/services/impl/GroovyActionsServiceImpl.java +++ b/extensions/groovy-actions/services/src/main/java/org/apache/unomi/groovy/actions/services/impl/GroovyActionsServiceImpl.java @@ -408,6 +408,7 @@ public class GroovyActionsServiceImpl implements GroovyActionsService { int unchangedCount = 0; int recompiledCount = 0; int errorCount = 0; + int newErrorCount = 0; long totalCompilationTime = 0; for (GroovyAction groovyAction : persistenceService.getAllItems(GroovyAction.class)) { @@ -439,7 +440,7 @@ public class GroovyActionsServiceImpl implements GroovyActionsService { } } catch (Exception e) { - if (errorCount == 0 && recompiledCount == 0) { + if (newErrorCount == 0 && recompiledCount == 0) { LOGGER.info("Refreshing scripts from persistence layer..."); } @@ -450,6 +451,7 @@ public class GroovyActionsServiceImpl implements GroovyActionsService { Set<String> scriptErrors = loggedRefreshErrors.get(actionName); if (scriptErrors == null || !scriptErrors.contains(errorMessage)) { + newErrorCount++; LOGGER.error("Failed to refresh script: {}", actionName, e); // Prevent memory leak by limiting tracked errors before adding new entries @@ -478,7 +480,7 @@ public class GroovyActionsServiceImpl implements GroovyActionsService { this.scriptMetadataCache = newMetadataCache; - if (recompiledCount > 0 || errorCount > 0) { + if (recompiledCount > 0 || newErrorCount > 0) { long totalTime = System.currentTimeMillis() - startTime; LOGGER.info("Script refresh completed: {} unchanged, {} recompiled, {} errors. Total time: {}ms", unchangedCount, recompiledCount, errorCount, totalTime);