diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java index c1015ddf9409..57ba80307a61 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java @@ -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; @@ -77,6 +79,7 @@ public class TestCaseRepository extends EntityRepository { 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( @@ -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 deleteTestCaseResult(