mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-03-26 09:35:50 +00:00
Avoid infinite task queue retries when trying to compute repo vintages
GitHub consistently returns a 500 for large repos, so assume that the first commit is the repo creation date for them.
This commit is contained in:
parent
438cb1fdac
commit
728faecd4f
1 changed files with 7 additions and 1 deletions
|
|
@ -70,8 +70,14 @@ func computeVintage(c context.Context, userId int, userLogin string, repoId int,
|
|||
if response != nil && response.StatusCode == 409 {
|
||||
// GitHub returns with a 409 when a repository is empty.
|
||||
commits = make([]github.RepositoryCommit, 0)
|
||||
} else if response != nil && response.StatusCode >= 500 {
|
||||
// Avoid retries if GitHub can't load commits (this happens for repos
|
||||
// like AOSiP-Devices/kernel_xiaomi_laurel_sprout, presumably because
|
||||
// they have too many commits).
|
||||
log.Warningf(c, "Could not load commits for repo %s (%d), not retrying: %s", *repo.FullName, repoId, err.Error())
|
||||
commits = make([]github.RepositoryCommit, 0)
|
||||
} else if err != nil {
|
||||
log.Errorf(c, "Could not load commits for repo %s (%d): %s", *repo.FullName, repoId, err.Error())
|
||||
log.Errorf(c, "Could not load commits for repo %s (%d), will retry: %s", *repo.FullName, repoId, err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue