Skip to content

Commit 63ff658

Browse files
committed
remove the first try catch since it is overkill
1 parent 259f4e5 commit 63ff658

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

src/main/java/it/aboutbits/springboot/emailservice/lib/application/SendScheduledEmails.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,7 @@ void sendEmails() {
5050
var countError = 0;
5151
for (var id : candidateIds) {
5252
Optional<Email> claimed;
53-
try {
54-
claimed = manageEmail.tryClaimForSend(id, staleSendingBefore);
55-
} catch (Exception e) {
56-
// Claim failed and rolled back: nothing was sent and the row is unchanged, so it stays claimable
57-
// Another pod may pick it up in this same pass, or it is retried on a later pass.
58-
log.error(
59-
JOB_DESCRIPTION + " | Failed to claim email for sending: {}. "
60-
+ "Nothing was sent and the row is unchanged; it stays claimable and may be picked up "
61-
+ "by another pod in this cycle or retried on a later pass.",
62-
id,
63-
e
64-
);
65-
continue;
66-
}
53+
claimed = manageEmail.tryClaimForSend(id, staleSendingBefore);
6754

6855
if (claimed.isEmpty()) {
6956
// Lost race to another pod; Skip

0 commit comments

Comments
 (0)