-
Notifications
You must be signed in to change notification settings - Fork 0
[Quiz][Refactor] 제미나이 SDK 타임아웃 및 재시도 설정 #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @sunwon12, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 Gemini SDK 연동의 안정성과 비용 관리 효율성을 향상시키기 위해 타임아웃 및 재시도 전략을 전면적으로 개선합니다. 요청별로 유연하게 타임아웃을 설정할 수 있게 되었으며, 특히 무료 티어의 엄격한 Quota 관리를 위해 408 및 429 에러에 대해서는 'Fail-Fast' 전략을 적용하여 정확한 집계를 우선시합니다. 이를 통해 시스템의 예측 가능성을 높이고 불필요한 자원 소모를 줄이는 것을 목표로 합니다. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
전반적으로 Gemini API 연동의 안정성과 비용 효율성을 높이기 위한 타임아웃 및 재시도 전략 리팩토링이 매우 인상적입니다. 특히, 요청별 타임아웃을 유연하게 설정하고, 무료 티어의 엄격한 Quota 관리를 위해 Fail-Fast 전략을 채택한 점이 돋보입니다. 의사결정 과정을 상세히 기술한 GEMINI_TIMEOUT_AND_RETRY_STRATEGY.md 문서 덕분에 변경 사항의 의도를 명확히 파악할 수 있었습니다.
다만, GeminiSdkClient 클래스에서 GenerateContentConfig를 생성하는 로직이 중복되고, 불필요한 메서드 호출이 발견되어 이 부분을 개선하면 코드의 유지보수성이 더욱 향상될 것입니다. 자세한 내용은 아래의 개별 리뷰 코멘트를 참고해 주세요.
| | `attempts` | **5회** | 최대 재시도 시도 횟수 | | ||
| | `initial_delay` | 1초 | 첫 재시도 전 대기 시간 | | ||
| | `max_delay` | 60초 | 재시도 대기 시간의 최대 상한 | | ||
| | `exp_base` | 2 | 지수 백오프(Exponential Backoff) 승수 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌻 테스트 커버리지 리포트
|
개요
Gemini API 연동의 안정성과 비용 관리 효율성을 높이기 위해 타임아웃 및 재시도 전략을 전면적으로 수정했습니다.
특히, 무료 티어의 엄격한 Quota(RPM/RPD) 관리를 위해 "정확한 집계"를 "재시도 편의성"보다 우선시하는 Fail-Fast 전략을 채택했습니다.
변경 사항
1. Request-Level Timeout 도입
GeminiClientManager등에서 전역 설정 불가 (SDK 기본값 의존) 또는 모든 요청에 동일 타임아웃 적용.GeminiRequestDTO에timeout필드 추가 (기본값: 60,000ms).2. Explicit Retry Policy (명시적 재시도 정책) 정의
GeminiSdkClient에HttpRetryOptions를 명시적으로 설정했습니다.attempts: 5회 (총 6회 시도)initialDelay: 1초 (Exponential Backoff, multiplier=2.0)maxDelay: 60초3. Fail-Fast Strategy for 408 & 429
다음 에러 코드는 SDK 자동 재시도 대상에서 제외했습니다.
GeminiRateLimiterService가 재고 차감 유지.📚 Documentation (문서화)
상세한 의사결정 과정과 트레이드오프 분석은 다음 문서에 정리했습니다.
docs/feature_description/GEMINI_TIMEOUT_AND_RETRY_STRATEGY.md