Skip to content

Commit 615cc9f

Browse files
resolved martin's comments
1 parent 3d2fd13 commit 615cc9f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pkg/sources/github/github_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func TestSource_ScanComments(t *testing.T) {
216216
}
217217

218218
func TestSource_ScanCommentsWithGraphql(t *testing.T) {
219-
feature.UseGithubGraphqlAPI.Store(true)
219+
feature.UseGithubGraphQLAPI.Store(true)
220220

221221
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
222222
defer cancel()

pkg/sources/github/graphql.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (s *Source) processIssuesWithComments(
7676
// request this issue more comments
7777
var commentsQuery singleIssueComments
7878
err := s.connector.GraphQLClient().Query(ctx, &commentsQuery, commentVars)
79-
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &query.RateLimit, err) {
79+
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &commentsQuery.RateLimit, err) {
8080
continue
8181
}
8282

@@ -167,7 +167,7 @@ func (s *Source) processPRWithComments(ctx context.Context, repoInfo repoInfo, r
167167
}
168168

169169
err := s.connector.GraphQLClient().Query(ctx, &commentQuery, singlePRVars)
170-
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &query.RateLimit, err) {
170+
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &commentQuery.RateLimit, err) {
171171
continue
172172
}
173173

@@ -288,7 +288,12 @@ func (s *Source) fetchThreadComments(ctx context.Context, threadIDs []string, re
288288
commentsPagination: (*githubv4.String)(nil),
289289
}
290290

291-
if err := s.connector.GraphQLClient().Query(ctx, &query, reviewThreadVars); err != nil {
291+
err := s.connector.GraphQLClient().Query(ctx, &query, reviewThreadVars)
292+
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &query.RateLimit, err) {
293+
continue
294+
}
295+
296+
if err != nil {
292297
return fmt.Errorf("single-thread query failed: %w", err)
293298
}
294299

@@ -348,7 +353,6 @@ func (s *Source) handleGraphQLRateLimit(ctx context.Context, rl *rateLimit, errI
348353
}
349354

350355
var retryAfter time.Duration
351-
// if rate limit exceeded error happened, wait for 5 minute before trying again
352356
if errIn != nil && strings.Contains(errIn.Error(), "rate limit exceeded") {
353357
now := time.Now()
354358

0 commit comments

Comments
 (0)