Skip to content

Commit

Permalink
release: 0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb committed Jan 30, 2024
1 parent e1ae2e8 commit 6e1d8ae
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ 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/domain/Alertable.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ public interface Alertable {
String title();

String body();

String type();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ public String title() {
public String body() {
return "모임 장소로 가서 틈틈 모임을 준비해주세요.";
}

@Override
public String type() {
return "BEFORE_MEETING";
}
}
2 changes: 0 additions & 2 deletions src/main/java/net/teumteum/alert/infra/FcmAlertPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ 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,13 +21,9 @@ public class MeetingAlertPublisher {

@Scheduled(cron = EVERY_ONE_MINUTES)
public void alertMeeting() {
System.out.println(">>> alertMeeting()");
var alertStart = LocalDateTime.now().plusMinutes(5).withNano(0).withSecond(0);
System.out.println(">>> alertStart " + alertStart);
var alertEnd = alertStart.plusMinutes(1).withNano(0).withSecond(0);
System.out.println(">>> alertEnd " + alertEnd);
var alertTargets = meetingRepository.findAlertMeetings(alertStart, alertEnd);
alertTargets.forEach(System.out::println);
alertTargets.forEach(meeting -> eventPublisher.publishEvent(
new MeetingAlerted(meeting.getParticipantUserIds())
)
Expand Down

0 comments on commit 6e1d8ae

Please sign in to comment.