Repository navigation
[#138] fix. 크론 스케줄러가 spring.task.scheduling 설정을 따르게 한다 - #268
Merged
Merged
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



배경
application.yml의spring.task.scheduling.pool.size: 3(#211)이 적용된 적이 없었다. 이 값은 Boot 자동설정의taskScheduler에만 쓰이는데, WebSocket 설정이TaskScheduler빈(messageBrokerTaskScheduler,webSocketHeartbeatScheduler)을 등록해서 자동설정이 꺼진다. 그러면TaskSchedulerRouter가 스레드 하나짜리 기본 실행기로 크론을 돌린다. 시작 로그에 "More than one TaskScheduler bean exists ..."가 남는다.그래서 #211이 막으려던 "월 00:00 퀴즈 오픈 알림이 도는 동안 매분
sweep이 밀린다"가 그대로 남아 있었다.이슈 #138은 처음에 "크론이 하트비트 스레드를 막는다"로 쓰였지만 전제가 틀렸다. 크론은 하트비트와 다른 스레드에서 돌고 있었다. 정정 내용은 이슈 댓글에 적었다.
변경
SchedulingConfig가SchedulingConfigurer를 구현하고, Boot의ThreadPoolTaskSchedulerBuilder로 크론 스케줄러를 만든다. 자동설정과 같은 빌더라spring.task.scheduling설정(스레드 수·이름 등)이 그대로 적용된다. 스레드 수는 yml에서만 정한다.pool-N-thread-11개 (yml 무시)scheduling-1~33개 (yml 적용)동작 변화
서로 다른 크론이 처음으로 동시에 돈다. 같은 크론은 이전처럼 자기 자신과 겹치지 않는다. 같은 시각에 걸리는 조합은 모두 매분
sweep+ 다른 크론 하나다.버그 리뷰로 본 동시 실행 영향:
sweep의 방 마감뿐이다. 목 05:00 매칭(이번 주 그룹)과sweep의 미응답 거절(지난주 그룹)은 대상이 다르다notification.created_at인덱스가 없어 04:10 알림 정리 DELETE가 끝날 때까지 같은 시각sweep의 알림 INSERT가 기다릴 수 있다. 잠금 대기 한도(50초)를 넘길 때만 피해가 있고, 04:10은 방 개방·마감 시각이 아니다확인
bootRun:jstack에scheduling-1~3,ws-heartbeat-1이 따로 있고sweepSQL이scheduling-1에서 찍힘. "More than one TaskScheduler" 로그 사라짐pool-3-thread-1하나에서 도는 것을 확인./gradlew :api:check통과 (테스트 1176개)SchedulingConfig는test프로필에서 꺼져 있어 자동 테스트로는 검증되지 않는다후속
스키마·공개 API 변경 없음.
Closes #138
🤖 Generated with Claude Code