Skip to content

Commit

Permalink
🐛 회원탈퇴시 S3에 삭제 안되던 버그 해결, 매일 2시에만 알림보내도록 변경, 1/2확률로 여행이 아니어도 알림 보냄
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Yong99 committed May 22, 2024
1 parent 66f8d67 commit 2aebe08
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void updateUserSetting(UserRequestDTO.updateUser request, Long userId) {
public void deleteUser(Long userId) {
User user = userRepository.findById(userId).orElseThrow(() -> new IllegalArgumentException("존재하지 않는 유저입니다."));
// S3 먼저 전부 삭제
// s3Service.deleteFile("", String.valueOf(userId));
s3Service.deleteFile("", String.valueOf(userId));
// 유저의 영수증 전부 삭제
receiptRepository.deleteAllByUser(user);
// 유저의 imageFile 전부 삭제
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public class SchedulerConfiguration {
private final UserRepository userRepository;

// 매일 오후 1시에 알림 발송
// @Scheduled(cron = "0 0 13 * * *")
@Scheduled(cron = "22 06 * * * *")
@Scheduled(cron = "0 0 14 * * *")
// @Scheduled(cron = "22 06 * * * *")
public void run() {
log.info("Noti Scheduler is running");
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,22 @@ public void sendQuestionNoti(User user, String question) {
}
if (!isTraveling){
log.info("User {} is not traveling today", user.getId());
return;
int rand = (int) (Math.random() * 10);
if (rand % 2 == 0){
log.info("Sending random notification to user {}", user.getId());
try {
ResponseEntity<Integer> ret = notiClient.pushMessage(
FcmSendDto.builder()
.token(user.getFirebaseToken())
.title("moment")
.body("문득 갑자기 떠나보는건 어때요?")
.build()
);
log.info("Notification sent to user {} with response {}", user.getId(), ret);
} catch (Exception e){
log.error("Failed to send notification to user {}", user.getId());
}
}
}
try {
ResponseEntity<Integer> ret = notiClient.pushMessage(
Expand Down

0 comments on commit 2aebe08

Please sign in to comment.