]> source.dussan.org Git - gitea.git/commitdiff
Check for context exceeded in WalkGitLog (#17319)
authorzeripath <art27@cantab.net>
Fri, 15 Oct 2021 18:41:34 +0000 (19:41 +0100)
committerGitHub <noreply@github.com>
Fri, 15 Oct 2021 18:41:34 +0000 (19:41 +0100)
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 <art27@cantab.net>
modules/git/log_name_status.go

index e792b02a5dc589611d87919fd3604af38d9b367a..8f816950dec3c8ccb5e3b215308a390f78c37c52 100644 (file)
@@ -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
                }