Skip to content

feat(go): libs/ratelimit 모듈 추가 및 전체 scraper에 rate limiting 적용#261

Merged
kubrickcode merged 1 commit intomainfrom
develop/shlee/260
Nov 27, 2025
Merged

feat(go): libs/ratelimit 모듈 추가 및 전체 scraper에 rate limiting 적용#261
kubrickcode merged 1 commit intomainfrom
develop/shlee/260

Conversation

@kubrickcode
Copy link
Owner

  • libs/ratelimit 공통 모듈 생성 (Limiter 인터페이스 + 구현)
  • 4개 scraper 모두 ratelimit.Limiter 인터페이스로 통일
  • 테스트 용이성을 위한 noopLimiter mock 패턴 적용
  • 기존 golang.org/x/time/rate 직접 의존을 추상화로 개선

fix #260

@github-actions github-actions bot added the refactor Refactoring code label Nov 27, 2025
@kubrickcode
Copy link
Owner Author

/gemini review

@gemini-code-assist
Copy link

Summary of Changes

Hello @kubrickcode, 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은 Go 스크래퍼 애플리케이션 전반에 걸쳐 API 호출에 대한 속도 제한을 중앙 집중화하고 표준화하는 것을 목표로 합니다. libs/ratelimit이라는 새로운 공통 모듈을 도입하여 속도 제한 로직을 캡슐화하고, 모든 스크래퍼가 이 추상화된 인터페이스를 사용하도록 업데이트되었습니다. 이는 golang.org/x/time/rate 패키지에 대한 직접적인 의존성을 제거하고, 테스트 용이성을 향상시키며, 향후 속도 제한 정책 변경에 대한 유연성을 제공합니다. 결과적으로, API 요청 과부하를 방지하고 시스템 안정성을 높이는 데 기여합니다.

Highlights

  • libs/ratelimit 공통 모듈 생성: Limiter 인터페이스와 그 구현체를 포함하는 새로운 공통 모듈이 추가되었습니다.
  • 스크래퍼에 속도 제한 적용: 4개의 모든 스크래퍼(auction-item-stat, market-item-category, market-item, market-item-stat)에 새로 생성된 ratelimit.Limiter 인터페이스를 사용하여 속도 제한 기능이 통합되었습니다.
  • 테스트 용이성 개선: noopLimiter mock 패턴이 도입되어 속도 제한 로직 테스트가 더 쉬워졌습니다.
  • 속도 제한 추상화: 기존 golang.org/x/time/rate 직접 의존성을 새로운 ratelimit 인터페이스로 추상화하여 코드의 유연성과 유지보수성을 높였습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

libs/ratelimit 공통 모듈을 추가하고 스크레이퍼 전반에 적용하여 의존성을 추상화하고 코드의 모듈성을 높인 점이 좋습니다. 테스트 편의성을 위해 noopLimiter 패턴을 도입한 것도 훌륭합니다. 다만, 일부 스크레이퍼에서 속도 제한 로직이 누락된 부분이 있고, context.Background() 사용 방식, 테스트 케이스의 정확성, 설정값 하드코딩 등 몇 가지 개선할 점이 보입니다. 자세한 내용은 각 파일에 남긴 주석을 참고해주세요.

- libs/ratelimit 공통 모듈 생성 (Limiter 인터페이스 + 구현)
- 4개 scraper 모두 ratelimit.Limiter 인터페이스로 통일
- 테스트 용이성을 위한 noopLimiter mock 패턴 적용
- 기존 golang.org/x/time/rate 직접 의존을 추상화로 개선

fix #260
@kubrickcode
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

새로운 ratelimit 공통 모듈을 추가하여 API 호출 속도 제어를 추상화하고, 이를 모든 스크레이퍼에 일관되게 적용한 점이 좋습니다. 이를 통해 코드의 모듈성이 향상되었고, noopLimiter 목(mock) 패턴을 사용하여 테스트 용이성을 높인 것도 훌륭합니다. 전반적으로 좋은 방향의 개선입니다. 다만, 몇몇 스크레이퍼에서 context.Background()를 직접 사용하고 있어 스타일 가이드에 어긋나는 부분이 있습니다. 이 부분을 수정하면 더 견고한 코드가 될 것입니다. 관련하여 몇 가지 리뷰 의견을 남겼습니다.

@kubrickcode kubrickcode merged commit a379535 into main Nov 27, 2025
6 checks passed
@kubrickcode kubrickcode deleted the develop/shlee/260 branch November 27, 2025 14:22
@kubrickcode
Copy link
Owner Author

🎉 This PR is included in version 0.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactoring code released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

공용 RateLimiter 일괄 적용

1 participant