From 58cd55d3535e5afe551610cb74588b33d97786a2 Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 15 Oct 2021 19:41:34 +0100 Subject: [PATCH] Check for context exceeded in WalkGitLog (#17319) There is a slight race in checking of a context deadline exceed in #16467 which leads to a 500 on the repository page. The solution is to check the error coming back from `*LogNameStatusRepoParser.Next()` and if it is the `ContextDeadlineExceeded` break from the loop. Fix #17314 Signed-off-by: Andrew Thornton --- modules/git/log_name_status.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/git/log_name_status.go b/modules/git/log_name_status.go index e792b02a5d..8f816950de 100644 --- a/modules/git/log_name_status.go +++ b/modules/git/log_name_status.go @@ -350,6 +350,9 @@ heaploop: } current, err := g.Next(treepath, path2idx, changed, maxpathlen) if err != nil { + if err == context.DeadlineExceeded { + break heaploop + } g.Close() return nil, err }