diff --git a/journey/plans/archive/260102_db_scheduler_management.md b/journey/plans/archive/260102_db_scheduler_management.md index 8ed8a4e..47b08d0 100644 --- a/journey/plans/archive/260102_db_scheduler_management.md +++ b/journey/plans/archive/260102_db_scheduler_management.md @@ -35,6 +35,8 @@ CREATE TABLE IF NOT EXISTS scheduled_jobs ( | `diary_generator` | `app.scheduler.jobs.diary_generator._run_diary_generator_with_logging` | sync 래퍼 | | `naverworks_briefing` | `app.scheduler.jobs.naverworks_briefing._run_briefing_with_logging` | sync 래퍼 | | `coldmail_briefing` | `app.scheduler.jobs.coldmail_briefing._run_coldmail_briefing_with_logging` | sync 래퍼 | +| `daily_headlines` | `app.scheduler.jobs.daily_headlines._run_headlines_with_logging` | sync 래퍼, channel_id config 필요 | +| `companyx_news` | `app.scheduler.jobs.companyx_news._run_companyx_news_with_logging` | sync 래퍼 | ## 구현 완료 (Phase 1-7) @@ -42,6 +44,6 @@ CREATE TABLE IF NOT EXISTS scheduled_jobs ( - Phase 3: `app/scheduler/db_loader.py` - DB 로더 - Phase 4: `main.py:146-149` - DB 기반 로드로 전환 - Phase 5: `app/router/scheduler_endpoint.py` - API 엔드포인트 -- Phase 6: `scripts/migrate_schedules_to_db.py` - 기존 데이터 마이그레이션 (4개 스케줄러) +- Phase 6: `scripts/migrate_schedules_to_db.py` - 기존 데이터 마이그레이션 (6개 스케줄러: daily_diary, naverworks_daily, coldmail_daily, lunch_worldcup, daily_headlines, companyx_news) - Phase 7: Pydantic Settings 전환 - `app/core/config.py`에 스케줄러 설정 추가, `os.getenv()` 제거 diff --git a/journey/troubleshooting/260102_db_scheduler_management.md b/journey/troubleshooting/260102_db_scheduler_management.md index 71cfe2e..f3f0c8d 100644 --- a/journey/troubleshooting/260102_db_scheduler_management.md +++ b/journey/troubleshooting/260102_db_scheduler_management.md @@ -43,16 +43,22 @@ ### Phase 6: 기존 데이터 마이그레이션 - `scripts/migrate_schedules_to_db.py`: 환경변수 기반 스케줄러를 DB로 마이그레이션 -- 4개 스케줄러 마이그레이션: daily_diary, naverworks_daily, coldmail_daily, lunch_worldcup +- 6개 스케줄러 마이그레이션: daily_diary, naverworks_daily, coldmail_daily, lunch_worldcup, daily_headlines, companyx_news - 실행: `python -m scripts.migrate_schedules_to_db` -- 서버 재시작 후 DB에서 3개 enabled 잡 정상 로드 확인 +- 서버 재시작 후 DB에서 5개 enabled 잡 정상 로드 확인 ### Phase 7: Pydantic Settings 전환 - `app/core/config.py`: 스케줄러 관련 설정 추가 (하위 호환성 유지) - `app/scheduler/jobs/*.py`: `os.getenv()` → `settings` 사용으로 전환 -- `main.py`: daily_headlines, companyx_news도 Settings 사용 +- `main.py`: daily_headlines, companyx_news 직접 등록 코드 제거, DB 로더로 통합 - 모든 스케줄러 관련 환경변수를 Pydantic Settings로 통합 +### 추가 완료: daily_headlines, companyx_news DB 전환 +- `app/scheduler/jobs/daily_headlines.py`, `companyx_news.py`: 래퍼 함수 추가 +- `db_loader.py`: JOB_TYPE_MAP에 daily_headlines, companyx_news 추가, config에서 channel_id 추출 로직 추가 +- `main.py`: daily_headlines, companyx_news 직접 등록 코드 완전 제거 +- 모든 스케줄러(6개) DB 기반 관리로 전환 완료, .env 파일 정리 완료 + ### 테스트 이슈 해결 - JSONB 파싱: `asyncpg`가 JSONB를 string으로 반환 → `json.loads()` 적용 - E2E 테스트 이벤트 루프 충돌: `pytest-asyncio`와 `TestClient` 충돌 @@ -63,9 +69,12 @@ - Phase 1-5 커밋: `1e82dee` (2026-01-02) - Phase 6 커밋: `0d0a098` (2026-01-02) - Phase 7 커밋: `f5ac6e9` (2026-01-02) +- daily_headlines, companyx_news 전환 커밋: `e3226f2` (2026-01-02) +- news_posting_skill.py 원칙 준수 커밋: `8b54c56` (2026-01-02) - 테스트: 13개 모두 통과 (repository 5, loader 3, E2E 5) -- 마이그레이션: 4개 스케줄러 DB 삽입 완료, 서버 재시작 후 3개 enabled 잡 정상 로드 +- 마이그레이션: 6개 스케줄러 DB 삽입 완료, 서버 재시작 후 5개 enabled 잡 정상 로드 - Settings 전환: 모든 스케줄러 관련 환경변수를 Pydantic Settings로 통합 완료 +- .env 정리: 스케줄러 관련 환경변수 13개 주석 처리 완료 - 배포: Gitea Actions 자동 배포 완료 ## 교훈