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

#457 추천인 시스템 구현 #470

Merged
merged 6 commits into from
Feb 22, 2024
Merged

#457 추천인 시스템 구현 #470

merged 6 commits into from
Feb 22, 2024

Conversation

kmc7468
Copy link
Member

@kmc7468 kmc7468 commented Feb 20, 2024

Summary

It closes #457
추천인 시스템을 구현하기 위해, 초대 링크 관련 API를 구현합니다.

Further Work

@kmc7468 kmc7468 self-assigned this Feb 20, 2024
@kmc7468 kmc7468 linked an issue Feb 20, 2024 that may be closed by this pull request
2 tasks
@kmc7468 kmc7468 marked this pull request as ready for review February 20, 2024 15:31
@kmc7468
Copy link
Member Author

kmc7468 commented Feb 20, 2024

5회마다 eventSharing5 퀘스트가 달성되는 것도 테스트 완료되었습니다. 아래 이미지를 참고해 주세요.

image

@@ -154,6 +154,7 @@ const completeQuest = async (userId, timestamp, quest) => {
logger.info(`User ${userId} successfully completed ${quest.id}Quest`);
return {
quest,
questCount: questCount + 1,
Copy link
Member Author

Choose a reason for hiding this comment

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

사실 조금 위험한 코드이긴한데, MongoDB에 트랜잭션을 도입하여 퀘스트 달성에 필요한 7단계의 작업을 Atomic하게 처리하지 않으면 완벽하게 해결할 방법이 딱히 없는 것 같습니다.

왜 위험한 코드라고 판단했냐면, 혹시라도 같은 유저가 같은 퀘스트를 달성하고자 하는 요청이 동시에 여러 번 들어오게 되면, await 때문에 7단계가 쪼개어져 처리되면서 questCount 값이 부정확하게 될 수도 있기 때문입니다. 물론 발생 가능성이 매~우 낮은 시나리오이긴 합니다..

@kmc7468
Copy link
Member Author

kmc7468 commented Feb 22, 2024

리뷰 요청 드린 분들 다들 바쁘신 것 같아서 바로 머지하겠습니다!

@kmc7468 kmc7468 merged commit c6e617b into dev Feb 22, 2024
1 check passed
@kmc7468 kmc7468 deleted the #457-add-invite-system branch February 22, 2024 12:44
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.

추천인 시스템 구현
1 participant