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 authored and o-kopysov committed Feb 13, 2024
1 parent 54e90ce commit a778ef6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 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,23 @@ 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++);
try {
addFirst(webhookConfig);
} catch (InterruptedException e1) {
log.warn("Failed to update Queue element");
}
queueRepository.save(webhookConfig);
} else {
log.warn(
"Maximum amount of processing webhook reached for pull request: "
+ pullRequest.getId()
+ " "
+ pullRequest.getPullRequestUrl());
delete(webhookConfig);
}
}
}
}

0 comments on commit a778ef6

Please sign in to comment.