Skip to content

Commit

Permalink
Check for context exceeded in WalkGitLog
Browse files Browse the repository at this point in the history
There is a slight race in checking of a context deadline exceed in go-gitea#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 go-gitea#17314

Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Oct 15, 2021
1 parent a889d0c commit 5952d34
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/git/log_name_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 5952d34

Please sign in to comment.