feat: Daily 모드 ConnectionError 재시도 로직 추가 (#209) #223

Merged
jihoson merged 1 commits from feature/issue-209-daily-connection-retry into main 2026-02-23 14:57:26 +09:00
Collaborator

Summary

  • Daily 모드에서 네트워크 장애로 ConnectionError 발생 시 재시도 없이 바로 실패하는 문제 수정
  • 읽기 전용 API(price/balance)에만 재시도 적용 — 주문은 멱등성 없으므로 재시도 X

변경 내역

src/main.py

  • _retry_connection(coro_factory, *args, label, **kwargs) 헬퍼 추가
    • MAX_CONNECTION_RETRIES(3) 번 시도, attempt당 2^attempt초 sleep
    • 모든 재시도 소진 시 ConnectionError re-raise
  • run_daily_session()get_current_price / get_overseas_price 호출에 적용
  • run_daily_session()get_balance / get_overseas_balance 호출에 적용
    • 잔고 조회 최종 실패 시 continue로 해당 마켓 스킵 (다른 마켓은 처리 계속)

tests/test_main.py

  • TestRetryConnection 클래스 추가 (5개 테스트)
    • 첫 시도 성공 / ConnectionError 후 재시도 성공 / 모든 재시도 소진 후 raise
    • args/kwargs 전달 / 비-ConnectionError는 즉시 propagate

Test plan

  • 766 passed, 0 failed
  • TestRetryConnection 5개 모두 통과

Closes #209

🤖 Generated with Claude Code

## Summary - Daily 모드에서 네트워크 장애로 ConnectionError 발생 시 재시도 없이 바로 실패하는 문제 수정 - 읽기 전용 API(price/balance)에만 재시도 적용 — 주문은 멱등성 없으므로 재시도 X ## 변경 내역 ### `src/main.py` - `_retry_connection(coro_factory, *args, label, **kwargs)` 헬퍼 추가 - MAX_CONNECTION_RETRIES(3) 번 시도, attempt당 2^attempt초 sleep - 모든 재시도 소진 시 ConnectionError re-raise - `run_daily_session()` — `get_current_price` / `get_overseas_price` 호출에 적용 - `run_daily_session()` — `get_balance` / `get_overseas_balance` 호출에 적용 - 잔고 조회 최종 실패 시 `continue`로 해당 마켓 스킵 (다른 마켓은 처리 계속) ### `tests/test_main.py` - `TestRetryConnection` 클래스 추가 (5개 테스트) - 첫 시도 성공 / ConnectionError 후 재시도 성공 / 모든 재시도 소진 후 raise - args/kwargs 전달 / 비-ConnectionError는 즉시 propagate ## Test plan - [x] 766 passed, 0 failed - [x] TestRetryConnection 5개 모두 통과 Closes #209 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agentson added 1 commit 2026-02-23 12:51:27 +09:00
feat: Daily 모드 ConnectionError 재시도 로직 추가 (issue #209)
Some checks failed
CI / test (pull_request) Has been cancelled
ac4fb00644
- _retry_connection() 헬퍼 추가: MAX_CONNECTION_RETRIES(3회) 지수 백오프
  (2^attempt 초) 재시도, 읽기 전용 API 호출에만 적용 (주문 제외)
- run_daily_session(): get_current_price / get_overseas_price 호출에 적용
- run_daily_session(): get_balance / get_overseas_balance 호출에 적용
  - 잔고 조회 전체 실패 시 해당 마켓을 skip하고 다른 마켓은 계속 처리
- 테스트 5개 추가: TestRetryConnection 클래스

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jihoson merged commit da585ee547 into main 2026-02-23 14:57:26 +09:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#223