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

#333 fcmUtils, 알림 비동기 처리 #346

Merged
merged 5 commits into from
Aug 6, 2024

Conversation

sojungpp
Copy link
Member

@sojungpp sojungpp commented Aug 6, 2024

📍 이슈 번호


🛠️ 작업 내용

1. FcmUtils 생성

firebase와 연결되는 로직들을 별도로 분리했습니다. b344940

2. 알림 비동기 처리

AS-IS
동기처리 = A 알림 전송 -> A 응답 -> B 알림 전송 -> B 응답

TO-BE
비동기처리 - enqueue 이용

client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
log.info("알림 실패: ", e.toString());
throw new BaseException(FIREBASE_SERVER_ERROR);
}
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) {
log.info("알림 성공: ", response.body().toString());
}
});

참고자료 참고자료2

3. 로그

일부만 우선 남겨뒀는데, 로그 남기는 기준이나 네이밍 추후 정하면 좋을 듯합니도!


🎸 기타 사항

  • 기존 notificationService단에서 exception을 던져서 fridgeService에서 try-catch로 처리 -> FcmUtils에서 exception 처리
    변경해서 에러 없애고자 코드 수정했습니다. c613918

@sojungpp sojungpp added the ♻️ refactor 리팩토링 label Aug 6, 2024
@sojungpp sojungpp self-assigned this Aug 6, 2024
@sojungpp sojungpp requested a review from psyeon1120 as a code owner August 6, 2024 06:12
@@ -85,12 +85,10 @@ public Long addFridge(AddFridgeReq addFridgeReq, Long ownerId) {
fridgeUserRepository.saveAll(members);
cartRepository.save(Cart.toEntity(fridge));

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

신경쓰였는데 압도적 감사...

@psyeon1120 psyeon1120 merged commit 223e014 into develop Aug 6, 2024
1 check passed
@psyeon1120 psyeon1120 deleted the refactor/#333-notificationService branch August 6, 2024 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
♻️ refactor 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[refactor] Notification 클린 코드 적용 및 성능 개선
2 participants