From 728faecd4f8d2d3875a5acabb08f0ae0741c55e1 Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Sun, 3 May 2020 10:55:30 -0700 Subject: [PATCH] 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. --- app/repos.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/repos.go b/app/repos.go index 7e0cfa1..aab958d 100644 --- a/app/repos.go +++ b/app/repos.go @@ -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 }