RED-10353: Increase drools timeout, different error message for the file that caused the timeout

This commit is contained in:
Dominique Eifländer 2024-10-31 11:10:54 +01:00
parent f8e2aae6e7
commit 1abceb2e20
6 changed files with 15 additions and 6 deletions

View File

@ -32,7 +32,7 @@ public class RedactionServiceSettings {
private int dictionaryCacheExpireAfterAccessDays = 3;
private int droolsExecutionTimeoutSecs = 300;
private int droolsExecutionTimeoutSecs = 600;
private boolean ruleExecutionSecured = true;

View File

@ -123,7 +123,7 @@ public class ComponentDroolsExecutionService {
logger.error(e, "Exception during rule execution");
kieSession.dispose();
if (e.getCause() instanceof TimeoutException) {
throw new DroolsTimeoutException(e, false, RuleFileType.COMPONENT);
throw new DroolsTimeoutException(String.format("The file %s caused a timeout",context.getFileId()), e, false, RuleFileType.COMPONENT);
}
throw new RuntimeException(e);
} catch (InterruptedException e) {
@ -131,7 +131,7 @@ public class ComponentDroolsExecutionService {
kieSession.dispose();
throw new RuntimeException(e);
} catch (TimeoutException e) {
throw new DroolsTimeoutException(e, false, RuleFileType.COMPONENT);
throw new DroolsTimeoutException(String.format("The file %s caused a timeout",context.getFileId()), e, false, RuleFileType.COMPONENT);
}
List<FileAttribute> resultingFileAttributes = getFileAttributes(kieSession);

View File

@ -156,7 +156,7 @@ public class EntityDroolsExecutionService {
logger.error(e, "Exception during rule execution");
kieSession.dispose();
if (e.getCause() instanceof TimeoutException) {
throw new DroolsTimeoutException(e, false, RuleFileType.ENTITY);
throw new DroolsTimeoutException(String.format("The file %s caused a timeout",context.getFileId()), e, false, RuleFileType.ENTITY);
}
throw new RuntimeException(e);
} catch (InterruptedException e) {
@ -164,7 +164,7 @@ public class EntityDroolsExecutionService {
kieSession.dispose();
throw new RuntimeException(e);
} catch (TimeoutException e) {
throw new DroolsTimeoutException(e, false, RuleFileType.ENTITY);
throw new DroolsTimeoutException(String.format("The file %s caused a timeout",context.getFileId()), e, false, RuleFileType.ENTITY);
}
List<FileAttribute> resultingFileAttributes = getFileAttributes(kieSession);

View File

@ -22,6 +22,14 @@ public class DroolsTimeoutException extends RuntimeException {
}
public DroolsTimeoutException(String message, Throwable cause, boolean reported, RuleFileType ruleFileType) {
super(message, cause);
this.reported = reported;
this.ruleFileType = ruleFileType;
}
public DroolsTimeoutException(boolean reported, RuleFileType ruleFileType) {
super(DROOLS_TIMEOUT_MESSAGE);

View File

@ -261,6 +261,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
}
@Disabled
@Test
public void testDoseMortalityExtraction() {

@ -1 +1 @@
Subproject commit 5705cc0782605fdca5dfff134b436f7143c9e421
Subproject commit 0da08b1d9d1bc815a3fb51aa9638eafea2cf02d5