Skip to content

Commit

Permalink
fix: remove PR if max attempt reached
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Rudyk <m.rudyk@samsung.com>
  • Loading branch information
m-rudyk committed Feb 15, 2024
1 parent 6b3112f commit 72493cd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/com/lpvs/service/LPVSQueueService.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,18 @@ public void processWebHook(LPVSQueue webhookConfig) {
pullRequest = lpvsPullRequestRepository.saveAndFlush(pullRequest);
log.error("Can't authorize commentResults() " + e);
e.printStackTrace();
delete(webhookConfig);
int currentAttempts = webhookConfig.getAttempts();
if (currentAttempts < maxAttempts) {
webhookConfig.setAttempts(currentAttempts+1);
queueRepository.save(webhookConfig);
} else {
log.warn(
"Maximum amount of processing webhook reached for pull request: "
+ pullRequest.getId()
+ " "
+ pullRequest.toString());
delete(webhookConfig);
}
}
}
}

0 comments on commit 72493cd

Please sign in to comment.