refactor(agent): extract RateLimiterControlMixin (955 → 865 LOC)#39
Merged
Conversation
…5 LOC) agent.py에서 Rate Limiter 제어 메서드 4개를 별도 Mixin으로 분리. 분리 대상 (kis_agent/core/rate_limiter_mixin.py): - get_rate_limiter_status() — 상태 조회 - set_rate_limits() — 제한 값 동적 변경 - reset_rate_limiter() — 통계/백오프 초기화 - enable_adaptive_rate_limiting() — 적응형 속도 조절 토글 분리 근거: - 4개 메서드 모두 self.rate_limiter에만 의존, 다른 도메인 API와 결합 없음 - 모두 단순 위임 layer (예외 처리·비활성 경고 외 로직 없음) - 기존 TechnicalAnalysisMixin / MethodDiscoveryMixin과 동일한 컨벤션 - Agent 클래스에서 도메인 API 코드와 인프라 제어 코드 분리 공개 API 영향 없음: - agent.get_rate_limiter_status() 등 사용자 호출 방식 동일 - Agent.__mro__: [Agent, TechAnalysisMixin, MethodDiscoveryMixin, RateLimiterControlMixin, BaseExceptionHandler, object] 검증: - pytest tests/unit/test_agent.py tests/unit/test_agent_unit_comprehensive.py tests/unit/test_rate_limiter.py: 49/49 passed - ruff check: All checks passed
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.
Summary
`kis_agent/core/agent.py` (955 LOC)의 Rate Limiter 제어 메서드 4개를 `RateLimiterControlMixin`으로 분리.
Changes
분리 근거
다른 800+ LOC 파일 평가 (분리 보류)
공개 API 영향
없음. `agent.get_rate_limiter_status()` 등 사용자 호출 방식 동일. Agent.__mro__에 Mixin 한 단계 추가.
Test plan