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

[Refactor] #252 - S3 Presigned Url 서비스 리팩토링 #253

Merged
merged 6 commits into from
Mar 13, 2024

Conversation

its-sky
Copy link
Member

@its-sky its-sky commented Mar 13, 2024

🚀PullRequest🚀

📟 관련 이슈

💻 작업 내용

  • Presigned Url을 통한 이미지 업로드 및 유저 프로필 변경 로직을 구현하였습니다.

프로세스

  1. GET /v1/image 를 통해 이미지를 등록할 filename 및 Presigned Url을 받아온다.
  2. 해당 Url을 통해 binary 형태로 이미지 파일을 payload에 담아 PUT request를 보낸다.
  3. 성공 후에 해당 성공을 서버에 알리기 위해 POST /v1/image 에 fileName과 imageType을 담아 요청한다.
  4. S3Service에서 해당 notify를 받게 되면 ImageEvent를 발행하여 ImageEventListener가 UserService의 updateUserProfileImage 메소드를 호출한다. 여기서 중요한건 해당 notify가 실패하게 되더라도 S3에 이미 이미지가 업로드 된 상태이기도 하고 notification이 실패했다고 다시 api call을 하는건 UX적으로 문제가 있기 때문에 @retryable 어노테이션을 통해 최대 3번의 재요청을 한다. 각 요청은 2초 간격으로 발생한다.
  5. ImageEventListener는 S3Service의 notifyImageSaveSuccess 메소드가 커밋되기 전에 실행되도록 @TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) 를 통해 처리한다.

📝 리뷰 노트

@its-sky its-sky requested a review from 0lynny March 13, 2024 11:33
@its-sky its-sky self-assigned this Mar 13, 2024
Copy link
Member

@0lynny 0lynny left a comment

Choose a reason for hiding this comment

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

p1 사항만 반영 부탁드려요 ! 수고 많으셨습니다

@its-sky its-sky merged commit 20f90a8 into develop Mar 13, 2024
1 check passed
@its-sky its-sky deleted the feature/#252 branch May 29, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] S3 Presigned Url 서비스 리팩토링
2 participants