Skip to content

Commit a308cd3

Browse files
committed
Fix retrieving commits when more than 10,000
1 parent c82f216 commit a308cd3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/gitlab/service.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ func (s *Service) fetchCommitPage(ctx context.Context, user *pkg.User, page, per
172172
commits = append(commits, pkg.NewCommit(*c.CommittedDate, projectID, c.ID))
173173
}
174174

175+
// For performance reasons, if a query returns more than 10,000 records, GitLab
176+
// doesn't return TotalPages
177+
if resp.TotalPages == 0 {
178+
return commits, resp.NextPage, nil
179+
}
180+
175181
if resp.CurrentPage >= resp.TotalPages {
176182
return commits, 0, nil
177183
}

0 commit comments

Comments
 (0)