Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Gorzala committed Mar 31, 2024
1 parent 90dc7e5 commit a73059a
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import net.dancier.kikeriki.application.CheckAndSendService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
Expand All @@ -16,6 +17,8 @@ public class InfoMailCheckJob {

private final ScheduledInfoMailCheckJpaRepository scheduledInfoMailCheckJpaRepository;

private final CheckAndSendService checkAndSendService;

@Scheduled(fixedRate = 5000L)
public void check() {
log.info("checking");
Expand All @@ -25,9 +28,17 @@ public void check() {
checkAndSend(scheduledInfoMailCheckJpaEntity);
}
}
@Transactional
private void checkAndSend(ScheduledInfoMailCheckJpaEntity scheduledInfoMailCheckJpaEntity) {
log.info("bla");

private void checkAndSend(ScheduledInfoMailCheckJpaEntity scheduledInfoMailCheckJpaEntity) {
try {
checkAndSendService.checkAndSend(scheduledInfoMailCheckJpaEntity.getDancerId());
log.info("Sucess setting status to done");
scheduledInfoMailCheckJpaEntity.setStatus(ScheduledInfoMailCheckJpaEntity.STATUS.DONE);

} catch (Exception exception) {
scheduledInfoMailCheckJpaEntity.setStatus(ScheduledInfoMailCheckJpaEntity.STATUS.FINALLY_FAILED);
} finally {
scheduledInfoMailCheckJpaRepository.save(scheduledInfoMailCheckJpaEntity);
}
}
}

0 comments on commit a73059a

Please sign in to comment.