mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-25 06:28:22 +00:00
MINOR - Async test case result deletion (#19390)
* fix: async test case result deletion * move async call to calling method
This commit is contained in:
parent
6f63a51024
commit
d8e6219200
@ -24,6 +24,8 @@ import java.util.List;
|
||||
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;
|
||||
@ -78,6 +80,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(
|
||||
@ -382,10 +385,17 @@ public class TestCaseRepository extends EntityRepository<TestCase> {
|
||||
}
|
||||
|
||||
private void deleteAllTestCaseResults(String fqn) {
|
||||
// Delete all the test case results
|
||||
TestCaseResultRepository testCaseResultRepository =
|
||||
(TestCaseResultRepository) Entity.getEntityTimeSeriesRepository(TEST_CASE_RESULT);
|
||||
testCaseResultRepository.deleteAllTestCaseResults(fqn);
|
||||
asyncExecutor.submit(
|
||||
() -> {
|
||||
try {
|
||||
testCaseResultRepository.deleteAllTestCaseResults(fqn);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error deleting test case results for test case {}", fqn, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user