-
Notifications
You must be signed in to change notification settings - Fork 0
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 #116] 알림 전송 배치 작업 #142
Conversation
override fun loadAllByShouldBeSentAt(now: LocalDate, pageable: Pageable): Page<AlertBatch> { | ||
return alertBatchRepository.findAllByShouldBeSentAtAfterAndSent(now, false, pageable) | ||
.map { it.toDomain() } | ||
} | ||
|
||
override fun send(alertBatch: AlertBatch) { | ||
alertBatchRepository.findByIdOrNull(alertBatch.id) | ||
?.sent() | ||
} |
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.
알림 설정 (y) 로 하면 알림 등록하는 부분은.. 이전에 커밋했던가요 ..?
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.
리뷰 이상 없으면 컨텐츠 생성, 수정작업에 해당 로직 추가하려했습니다! 지금은 없슴다ㅎ
) : ItemReader<AlertBatch> { | ||
|
||
private var currentPage: Int = 0 | ||
private val pageSize: Int = 50 |
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.
pageSIze랑 chunkSize 는 같이 관리해도 좋을 것 같아여 ! 항상 같은 값으로 설정해야하니까
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.
오키오키요!
fun sendAlertStep() = batch { | ||
step("sendAlertStep") { | ||
chunk(50, transactionManager, fun SimpleStepBuilderDsl<AlertBatch, AlertBatch>.() { | ||
reader(alertReader) | ||
processor(alertProcessor) | ||
writer(alertWriter) | ||
transactionAttribute(DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_NOT_SUPPORTED)) | ||
}) | ||
} | ||
} |
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.
BatchDsl 최고.. 네이버 최고..
companion object { | ||
private const val POOL_SIZE = 3 | ||
} | ||
|
||
@Bean("schedulerTask") | ||
fun taskScheduler(): TaskScheduler { | ||
val executor = ThreadPoolTaskScheduler() | ||
executor.poolSize = POOL_SIZE | ||
executor.threadNamePrefix = "scheduler-thread-" | ||
executor.initialize() | ||
return executor | ||
} |
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.
이거 pool size 왜 3으로 둔거예요 ??
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.
cpu 코어 1이니까 2로하려다가 3으로 했습니다! 근데 2로 수정하겠습니다
@Query( | ||
""" | ||
update AlertContentEntity ac set ac.deleted = true | ||
where ac.id in :ids | ||
""" | ||
) |
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.
이거 전송 완료했으면 그냥 하드딜리트 해도 될듯여 ㅇㅁㅇ? 알림 테이블에도 또 남으니까..
|
@jimin3263 AlertContent로 컨텐츠들을 전부 조회하는 게 번거롭다는 거였는데 알림 가는 시점 기준의 데이터로 알림 보내는 것이라는 중요한 사실을 망각하고 있었습니다.. 요거 로직 수정하겠습니다! 엔티티도 기존것으로 수정하겠습니다! |
⛏ 이슈 번호
close #116
📍 리뷰 포인트
📝 참고사항(Optional)
Item Reader
Item Processor
Item Writer