Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy/v1 #187

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5eff597
Merge pull request #65 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 7, 2024
b396ac1
Merge pull request #66 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 7, 2024
d3e78f1
Merge pull request #67 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 7, 2024
71849a9
Merge pull request #68 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 7, 2024
360f64d
Merge pull request #73 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 11, 2024
3878940
Merge pull request #74 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 11, 2024
618588a
Merge pull request #75 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 11, 2024
015a904
Merge pull request #81 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 15, 2024
bc0c35e
Merge pull request #82 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 15, 2024
0d310ca
Merge pull request #97 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 18, 2024
d5978b1
Merge pull request #98 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 18, 2024
db198ff
Merge pull request #105 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 19, 2024
f64c989
Merge pull request #111 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 27, 2024
910cf87
Merge pull request #114 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 29, 2024
e3fac12
Merge pull request #119 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 30, 2024
7c5af52
Merge pull request #121 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 30, 2024
5d30ed6
Merge pull request #123 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 30, 2024
cff7a99
Merge pull request #124 from kookmin-sw/backend/develop/v3
J-Yong99 Apr 30, 2024
cb6a3da
Merge pull request #125 from kookmin-sw/backend/develop/v3
J-Yong99 May 1, 2024
0ae10f1
풀 리퀘스트 병합 #126
J-Yong99 May 2, 2024
a8097f4
풀 리퀘스트 병합 #129
J-Yong99 May 3, 2024
6d515c3
Merge pull request #130 from kookmin-sw/backend/develop/v3
J-Yong99 May 3, 2024
0d49ff8
Merge pull request #131 from kookmin-sw/backend/develop/v3
J-Yong99 May 3, 2024
c8f339c
Merge pull request #133 from kookmin-sw/backend/develop/v3
J-Yong99 May 7, 2024
b6ea698
Merge pull request #134 from kookmin-sw/backend/develop/v3
J-Yong99 May 7, 2024
fda893b
Merge pull request #135 from kookmin-sw/backend/develop/v3
J-Yong99 May 8, 2024
4b8355e
Merge pull request #138 from kookmin-sw/backend/develop/v3
J-Yong99 May 8, 2024
18fdc5a
Merge pull request #140 from kookmin-sw/backend/develop/v3
J-Yong99 May 11, 2024
21c7725
풀 리퀘스트 병합 #145
J-Yong99 May 13, 2024
b63c859
풀 리퀘스트 병합 #146
J-Yong99 May 13, 2024
360e829
Merge pull request #147 from kookmin-sw/backend/develop/v3
J-Yong99 May 14, 2024
469abb7
Merge pull request #151 from kookmin-sw/backend/develop/v3
J-Yong99 May 14, 2024
5c8c507
Merge pull request #153 from kookmin-sw/backend/develop/v3
J-Yong99 May 15, 2024
3edc480
Merge pull request #156 from kookmin-sw/backend/develop/v3
J-Yong99 May 17, 2024
7cb9d6e
Merge pull request #158 from kookmin-sw/backend/develop/v3
J-Yong99 May 17, 2024
c95523c
풀 리퀘스트 병합 #159
J-Yong99 May 17, 2024
c0a0076
풀 리퀘스트 병합 #160
J-Yong99 May 17, 2024
5558073
풀 리퀘스트 병합 #161
J-Yong99 May 17, 2024
66f8d67
:sparkles: 여행 수정안되는 버그 해결
J-Yong99 May 20, 2024
2a0de17
Merge pull request #169 from kookmin-sw/backend/develop/v3
J-Yong99 May 20, 2024
2aebe08
:bug: 회원탈퇴시 S3에 삭제 안되던 버그 해결, 매일 2시에만 알림보내도록 변경, 1/2확률로 여행이 아니어도 알림 보냄
J-Yong99 May 22, 2024
6b8efc1
Merge pull request #176 from kookmin-sw/backend/develop/v3
J-Yong99 May 22, 2024
9bd1060
:sparkles: 경
J-Yong99 May 27, 2024
92a032d
풀 리퀘스트 병합 #177
J-Yong99 May 27, 2024
c239d64
:sparkles: 전시회
J-Yong99 May 30, 2024
4f05f7e
:sparkles: 전시회
J-Yong99 May 30, 2024
a863a01
Merge pull request #178 from kookmin-sw/backend/develop/v3
J-Yong99 May 30, 2024
f0c1716
:sparkles: 전시회
J-Yong99 Jun 17, 2024
1601b78
Merge pull request #179 from kookmin-sw/backend/develop/v3
J-Yong99 Jun 17, 2024
c6ad34b
:sparkles: ec2이름 변경
J-Yong99 Jul 6, 2024
153fdbd
Merge pull request #185 from kookmin-sw/backend/develop/v3
J-Yong99 Jul 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public Trip delete(Long tripId) {
public void update(Long userId, TripRequestDTO.UpdateTrip trip) {
Trip oldTrip = this.delete(trip.getTripId());
this.register(TripRequestDTO.RegisterTrip.builder()
.startDate(oldTrip.getStartDate())
.endDate(oldTrip.getEndDate())
.tripName(oldTrip.getTripName())
.startDate(trip.getStartDate())
.endDate(trip.getEndDate())
.tripName(trip.getTripName())
.build(), userId);
}

Expand Down
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
@@ -1,6 +1,8 @@
package com.moment.scheduler.config;

import com.moment.scheduler.domain.cardView.CardViewRepository;
import com.moment.scheduler.domain.user.UserRepository;
import com.moment.scheduler.service.CardViewService;
import com.moment.scheduler.service.NotiService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -16,10 +18,12 @@
public class SchedulerConfiguration {
private final NotiService notiService;
private final UserRepository userRepository;
private final CardViewService cardViewService;
private final CardViewRepository cardViewRepository;

// 매일 오후 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 All @@ -30,4 +34,19 @@ public void run() {
log.error("Failed to send notification");
}
}

// 매 한시간마다 분석요청
@Scheduled(cron = "0 0 * * * *")
public void run2() {
log.info("Analysis Scheduler is running");
try {
// 만약 분석중인 카드뷰가 하나라도 있는 경우
if (!cardViewRepository.findAllByRecordFileStatusIn(List.of("WAIT")).isEmpty()) {
cardViewService.getIncompleteCardViews();
}

} catch (Exception e) {
log.error("Failed to send notification");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public SchedulerResponseDTO.AIModelRunResponseDTO getIncompleteCardViews() throw
if (awsService.isEc2Running()){
throw new RuntimeException("EC2 is already running");
}
awsService.turnOnOrOff("moment-ai-t4", true);
awsService.turnOnOrOff("moment", true);
log.info("EC2 trying to turn on");
while (!awsService.isEc2Running()){
log.info("sleep");
Expand All @@ -50,7 +50,7 @@ public SchedulerResponseDTO.AIModelRunResponseDTO getIncompleteCardViews() throw
// 분석 완료 카드뷰 개수를 유저별로 저장
Map<User, Integer> userCardViewCount = new HashMap<>();

sleep(31000);
// sleep(31000);
// 경과 시간 체크를 위한 시작 시간
long startTime = System.currentTimeMillis();
List<CardView> cards = cardViewRepository.findAllByRecordFileStatusIn(List.of("WAIT"));
Expand Down Expand Up @@ -115,7 +115,7 @@ public SchedulerResponseDTO.AIModelRunResponseDTO getIncompleteCardViews() throw
}
long endTime = System.currentTimeMillis();
log.info("AI model run time : " + (endTime - startTime) + "ms");
awsService.turnOnOrOff("moment-ai-t4", false);
awsService.turnOnOrOff("moment", false);

// 분석한만큼 유저에게 알림을 전송
for (User user : userCardViewCount.keySet()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,35 @@ public void sendQuestionNoti(User user, String question) {
}
if (!isTraveling){
log.info("User {} is not traveling today", user.getId());
return;
}
try {
ResponseEntity<Integer> ret = notiClient.pushMessage(
FcmSendDto.builder()
.token(user.getFirebaseToken())
.title("moment")
.body(question)
.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());
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());
}
}
}else{
try {
ResponseEntity<Integer> ret = notiClient.pushMessage(
FcmSendDto.builder()
.token(user.getFirebaseToken())
.title("moment")
.body(question)
.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());
}
}
}

Expand Down
Loading