Skip to content

refactor: 매칭 스케줄을 히스토리 기반으로 변경#60

Merged
DaleSeo merged 1 commit intomainfrom
refactor/history-based-schedule
Apr 7, 2026
Merged

refactor: 매칭 스케줄을 히스토리 기반으로 변경#60
DaleSeo merged 1 commit intomainfrom
refactor/history-based-schedule

Conversation

@DaleSeo
Copy link
Copy Markdown
Member

@DaleSeo DaleSeo commented Apr 7, 2026

요약

  • 3/22에 매칭이 있었는데, 3/30에 또 매칭이 되는 문제가 발생했습니다. 그리고 4/6에는 또 매칭이 되지 않았습니다.
  • 이 문제를 해결하기 위해서 매칭 스케줄 판단 방식을 ISO 주 번호 기반에서 마지막 매칭일 기준 경과일 방식으로 변경합니다
  • coffee-test 역할의 스케줄을 weekly에서 manual로 변경하여 자동 매칭을 중단합니다. 테스트가 충분히 되었습니다.

변경 내용

스케줄 로직 변경 (schedule.ts)

  • 기존: ISO 주 번호의 홀짝으로 biweekly 판단, 첫째 월요일로 monthly 판단
  • 변경: history.json의 마지막 매칭일로부터 경과일 계산
    • weekly: 7일 이상 경과 시 실행
    • biweekly: 14일 이상 경과 시 실행
    • monthly: 28일 이상 경과 시 실행
    • manual: 자동 실행하지 않음 (수동 트리거만 가능)
  • getISOWeekNumber, isFirstMondayOfMonth 함수 삭제

실행 흐름 변경 (index.ts)

  • 매칭 이력 로드를 스케줄 체크보다 앞으로 이동하여 마지막 매칭일을 참조할 수 있도록 합니다

coffee-test 자동 매칭 중단 (roles.json)

  • coffee-test 역할의 schedule을 manual로 변경하여 cron 실행 시 건너뜁니다
  • workflow_dispatch로 수동 트리거 시에는 기존대로 실행 가능합니다

배경

  • ISO 주 번호 방식은 53주가 있는 해(2026년 등)에서 연말-연초 전환 시 3주 공백이 발생하는 문제가 있었습니다
  • coffee-testweekly로 설정되어 biweekly 역할의 쉬는 주에도 같은 채널에 매칭 알림이 가는 문제가 있었습니다

테스트

  • bun test 전체 통과 (59 tests)
  • bun run typecheck 통과
  • bun run lint 통과

@DaleSeo DaleSeo self-assigned this Apr 7, 2026
@DaleSeo DaleSeo requested a review from sounmind April 7, 2026 01:27
@DaleSeo DaleSeo marked this pull request as ready for review April 7, 2026 01:27
@DaleSeo DaleSeo force-pushed the refactor/history-based-schedule branch from f279ee3 to 01b0aff Compare April 7, 2026 01:36
@DaleSeo DaleSeo merged commit bc51cf5 into main Apr 7, 2026
1 check passed
@DaleSeo DaleSeo deleted the refactor/history-based-schedule branch April 7, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants