Skip to content

Commit

Permalink
release: 0.2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb committed Jan 30, 2024
1 parent dba755b commit 1626377
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.RequiredArgsConstructor;
import net.teumteum.alert.domain.AlertPublisher;
import net.teumteum.alert.domain.AlertService;
import net.teumteum.alert.domain.Alertable;
import net.teumteum.alert.domain.BeforeMeetingAlert;
import net.teumteum.meeting.domain.MeetingAlerted;
import org.springframework.context.annotation.Profile;
Expand All @@ -25,6 +24,7 @@ public class BeforeMeetingAlertHandler {
@Async(ALERT_EXECUTOR)
@EventListener({MeetingAlerted.class})
public void alert(MeetingAlerted alerted) {
System.out.println(">>> alert(" + alerted.userIds() + ")");
alertService.findAllByUserId(alerted.userIds())
.stream()
.map(userAlert -> new BeforeMeetingAlert(userAlert.getUserId(), userAlert.getToken(), Instant.now()))
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/teumteum/alert/infra/FcmAlertPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ public class FcmAlertPublisher implements AlertPublisher<BeforeMeetingAlert> {
@Override
@Async(FCM_ALERT_EXECUTOR)
public void publish(BeforeMeetingAlert beforeMeetingAlert) {
System.out.println(">>> publish(" + beforeMeetingAlert + ")");
var message = buildMessage(beforeMeetingAlert);
publishWithRetry(0, message, null);
}

private void publishWithRetry(int currentRetryCount, Message message, @Nullable ErrorCode errorCode) {
System.out.println(">>> publishWithRetry(" + currentRetryCount + ", " + message + ", " + errorCode + ")");
if (MAX_RETRY_COUNT == currentRetryCount) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class MeetingAlertPublisher {

@Scheduled(cron = EVERY_ONE_MINUTES)
public void alertMeeting() {
System.out.println(">>> alertMeeting()");
var alertStart = LocalDateTime.now().plusMinutes(5);
var alertEnd = alertStart.plusMinutes(1);
var alertTargets = meetingRepository.findAlertMeetings(alertStart, alertEnd);
Expand Down

0 comments on commit 1626377

Please sign in to comment.