agentson
|
a56adcd342
|
fix: add token refresh cooldown to prevent EGW00133 cascading failures (issue #54)
CI / test (pull_request) Has been cancelled
Prevents rapid retry attempts when token refresh hits KIS API's
1-per-minute rate limit (EGW00133: 접근토큰 발급 잠시 후 다시 시도하세요).
Changes:
- src/broker/kis_api.py:58-61 - Add cooldown tracking variables
- src/broker/kis_api.py:102-111 - Enforce 60s cooldown between refresh attempts
- tests/test_broker.py - Add cooldown behavior tests
Before:
- Token refresh fails with EGW00133
- Every API call triggers another refresh attempt
- Cascading failures, system unusable
After:
- Token refresh fails with EGW00133 (first attempt)
- Subsequent attempts blocked for 60s with clear error
- System knows to wait, prevents cascading failures
Test Results:
- All 285 tests pass
- New tests verify cooldown behavior
- Existing token management tests still pass
Implementation Details:
- Cooldown starts on refresh attempt (not just failures)
- Clear error message tells caller how long to wait
- Compatible with existing token expiry + locking logic
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-05 00:37:20 +09:00 |
|