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

feat : 선착순 등록 시 병목을 막기 위한 스케쥴러 구현 (CC-176) #45

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

putdata
Copy link
Collaborator

@putdata putdata commented Aug 22, 2024

📝 작업내용

  • 선착순 등록 시 병목을 막기 위한 스케쥴러 구현
    • Redis에 DB에 반영될 내용 저장
    • 2초마다 스케쥴링을 통해 Redis에서 100개를 가져와 실제 DB에 반영

💬 침고사항

📖 레퍼런스

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

리팩토링하면서 불필요한 임포트 삭제 필요

@putdata putdata self-assigned this Aug 22, 2024
@putdata putdata added 익준 feat📌 기능 개발 labels Aug 22, 2024
int completed = 0;
List<FindingGameWinner> winners = new ArrayList<>();
for (int i = 0; i < TRANSACTION_COUNT; i++) {
FindingGameRealWinner realWinner = findingGameRedisRepository.getFrontRealWinner();
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기서 바로 popRealWinner 하지않고 get 먼저 하는 이유가 몬가요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

중간에 에러뜨면 redis Pop된게 트랜잭션 유지가 안되서 어느정도 최대한 보존할 수 있게 했습니다.

@j2noo j2noo merged commit 7a9f884 into develop Aug 22, 2024
1 check passed
@putdata putdata deleted the CC-176 branch August 22, 2024 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat📌 기능 개발 익준
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants