Skip to content

Commit

Permalink
fix: async test case result deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
TeddyCr committed Jan 15, 2025
1 parent 195857a commit 8e3499b
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.json.JsonPatch;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
Expand Down Expand Up @@ -77,6 +79,7 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
private static final String PATCH_FIELDS =
"owners,entityLink,testSuite,testSuites,testDefinition,computePassedFailedRowCount,useDynamicAssertion";
public static final String FAILED_ROWS_SAMPLE_EXTENSION = "testCase.failedRowsSample";
private final ExecutorService asyncExecutor = Executors.newFixedThreadPool(1);

public TestCaseRepository() {
super(
Expand Down Expand Up @@ -338,7 +341,17 @@ protected void deleteChildren(
@Override
protected void cleanup(TestCase entityInterface) {
super.cleanup(entityInterface);
deleteAllTestCaseResults(entityInterface.getFullyQualifiedName());
asyncExecutor.submit(
() -> {
try {
deleteAllTestCaseResults(entityInterface.getFullyQualifiedName());
} catch (Exception e) {
LOG.error(
"Error deleting test case results for test case {}",
entityInterface.getFullyQualifiedName(),
e);
}
});
}

public RestUtil.PutResponse<TestCaseResult> deleteTestCaseResult(
Expand Down

0 comments on commit 8e3499b

Please sign in to comment.