Skip to content

Commit

Permalink
Adding conditions for updating testing run status
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark2307 committed Nov 11, 2024
1 parent 9584cb4 commit dc7e2ef
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apps/testing/src/main/java/com/akto/testing/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public void run() {
}
}
setTestingRunConfig(testingRun, trrs);

boolean maxRetriesReached = false;
if (isSummaryRunning || isTestingRunRunning) {
loggerMaker.infoAndAddToDb("TRRS or TR is in running state, checking if it should run it or not");
TestingRunResultSummary testingRunResultSummary;
Expand All @@ -354,9 +354,7 @@ public void run() {
} else {
Map<ObjectId, TestingRunResultSummary> objectIdTestingRunResultSummaryMap = TestingRunResultSummariesDao.instance.fetchLatestTestingRunResultSummaries(Collections.singletonList(testingRun.getId()));
testingRunResultSummary = objectIdTestingRunResultSummaryMap.get(testingRun.getId());
}

boolean maxRetriesReached = false;
}

if (testingRunResultSummary != null) {
List<TestingRunResult> testingRunResults = TestingRunResultDao.instance.fetchLatestTestingRunResult(Filters.eq(TestingRunResult.TEST_RUN_RESULT_SUMMARY_ID, testingRunResultSummary.getId()), 1);
Expand Down Expand Up @@ -421,7 +419,6 @@ public void run() {
// add max retries here and then mark last summary as completed when results > 0
if(maxRetriesReached){
loggerMaker.infoAndAddToDb("Exiting out as maxRetries have been reached for testingRun: " + testingRun.getHexId(), LogDb.TESTING);
return;
}else{
if (summaryId != null) {
trrs.setId(new ObjectId());
Expand Down Expand Up @@ -455,8 +452,11 @@ public void run() {
}
}
RequiredConfigs.initiate();
testExecutor.init(testingRun, summaryId, syncLimit);
raiseMixpanelEvent(summaryId, testingRun, accountId);
if(!maxRetriesReached){
testExecutor.init(testingRun, summaryId, syncLimit);
raiseMixpanelEvent(summaryId, testingRun, accountId);
}

} catch (Exception e) {
loggerMaker.errorAndAddToDb(e, "Error in init " + e);
}
Expand Down

0 comments on commit dc7e2ef

Please sign in to comment.