-
Notifications
You must be signed in to change notification settings - Fork 1
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
#508 [feat] 글모임 best 글/ 작가 반환 로직 구현 #509
Conversation
필명 이름 만들어주는 기능은 이제 사용하지 않기 때문에 삭제했습니다
Curious Repository에서 curious를 오늘부터 7일 전 까지 생성된 curious값을 바탕으로 Post, count를 추출하여 리턴하는 로직을 작성했습니다.
일주일마다 MoimPopularInfo 를 삭제하고 첫 번째 조회에서, 새롭게 만드는 방식으로 구현했습니다. Map<WriterName, Int> 를 사용해서 저장해뒀던 객체에서 작가와 궁금해요 count를 꺼내 상위 작가만 리턴했습니다.
만일 이번 주 궁금해요 top 2 컨텐츠가 부족하다면, 기존의 글/ 작가의 total Curious Count에서 받아오는 것을 추가하도록 했습니다.
Top 2 를 궁금해요 생성 시점을 기준으로 채우는 방식으로 변경
캐싱 관련해서 구현하면서 테스트 범위가 크지 않다고 판단하여 삭제했습니다
Caffeine 캐시를 사용하였는데, (EhCache보다 사용하기 쉬움) 이는 Scheduling이 되지 않아서 스케줄러를 직접 등록해야하기 때문에 스케줄러를 직접 등록했습니다. 스케줄러가 스레드를 잡아먹어서 이에 대해 방법을 고민해보겠습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L.G.T.M. 너무 고생하셨습니다!!
캐시전략까지.. 배워가는게 정말 많은 코드였네요👍 궁금한 부분들이 있어서 적어두었씁니다!
|
||
private Caffeine<Object, Object> caffeineConfig() { | ||
return Caffeine.newBuilder() | ||
.maximumSize(200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5) 캐시 최대 크기를 200으로 설정하신 이유가 있는지 궁금해요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Caffeine<Object, Object> caffeineConfig() { | ||
return Caffeine.newBuilder() | ||
.maximumSize(200) | ||
.expireAfterAccess(5, TimeUnit.DAYS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5) 7일간 캐시에 남아있는 데이터가 모두 유효해야 하는 것으로 이해했는데 ExpireAfterAccess 를 설정하신 이유가 궁금합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
첫 번째 조회할 때 기록이 만들어지는데, 그게 월요일이라는 보장이 없었습니다! 그래서 7일보다 짧은 5일로 설정하였고, 만일 업데이트 된다면 그 순간 부터 5일 연장이므로 5일도 충분하다고 생각했습니다!
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); | ||
Scheduler scheduler; | ||
scheduler = Scheduler.forScheduledExecutorService(executor); | ||
return scheduler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5) Executors.newSingleThreadScheduledExecutor() 대신, Executors.newScheduledThreadPool 로 비동기적으로 처리해서 말씀하신 스레드 문제를 해결하는 건 어떨까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
죻습니다!! 감사합니다! 스레드풀로 약 5개 정도 사용하면 될 것 같습니다!
✒️ 관련 이슈번호
Key Changes 🔑
To Reviewers 📢