Skip to content

feat: Cache issues of fetched repositories#10

Merged
ymtdzzz merged 1 commit intomainfrom
feature/cache_issues
Mar 20, 2025
Merged

feat: Cache issues of fetched repositories#10
ymtdzzz merged 1 commit intomainfrom
feature/cache_issues

Conversation

@ymtdzzz
Copy link
Copy Markdown
Owner

@ymtdzzz ymtdzzz commented Mar 20, 2025

closes: #9

This PR provides the feature to cache issues of fetched repositories.

❯ make run-local-action
2025/03/20 16:24:31 Github client is initialized with given credentials
2025/03/20 16:24:31 
2025/03/20 16:24:31 >> Fetching issues for groupA <<
2025/03/20 16:24:31 Query: repo:open-telemetry/opentelemetry-ruby is:open is:issue label:"help wanted","good first issue","bug"
2025/03/20 16:24:31 Fetching page 1 ...
2025/03/20 16:24:32 
2025/03/20 16:24:32 >> Fetching issues for groupB <<
2025/03/20 16:24:32 Cache hit for open-telemetry/opentelemetry-ruby
2025/03/20 16:24:32 Query: repo:open-telemetry/opentelemetry-ruby-contrib is:open is:issue label:"help wanted","good first issue","bug"
2025/03/20 16:24:32 Fetching page 1 ...
2025/03/20 16:24:32 
2025/03/20 16:24:32 >> Fetching issues for groupC <<
2025/03/20 16:24:32 Cache hit for open-telemetry/opentelemetry-ruby
2025/03/20 16:24:32 Cache hit for open-telemetry/opentelemetry-ruby-contrib
2025/03/20 16:24:32 All issues are fetched from cache!
2025/03/20 16:24:32 Removing old issues directory: ./example/issues

@ymtdzzz ymtdzzz requested a review from Copilot March 20, 2025 07:29
@ymtdzzz ymtdzzz self-assigned this Mar 20, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces caching for fetched repository issues to reduce redundant API calls. Key changes include:

  • Adding a cache field to the client struct and updating related methods in pkg/client/client.go.
  • Introducing a new test suite for the cache behavior in pkg/client/client_test.go.
  • Updating repository identifiers in tests to match the cache key format.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/client/client.go Added a cache field, updated NewClient and fetchIssuesByRepos logic to incorporate caching, and refined logging.
pkg/client/client_test.go Added TestCheckCache and updated existing tests to use repository keys instead of full GitHub URLs.
Comments suppressed due to low confidence (2)

pkg/client/client.go:103

  • [nitpick] Consider renaming the parameter 'ownerRepo' to something like 'repoKeys' for clearer intent.
func (c *client) checkCache(ownerRepo []string) ([]*github.Issue, []string) {

pkg/client/client_test.go:257

  • [nitpick] Confirm that test inputs consistently use repository keys (e.g. 'owner/repo') as expected by the production code, given the change from full URLs.
ownerRepos: []string{"owner1/repo1", "owner2/repo2"},

Comment thread pkg/client/client.go
@ymtdzzz ymtdzzz merged commit 4b8b58b into main Mar 20, 2025
2 checks passed
@ymtdzzz ymtdzzz deleted the feature/cache_issues branch March 20, 2025 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache fetched issues

2 participants