Skip to content

Commit

Permalink
Check for context exceeded in WalkGitLog (#17319)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zeripath authored Oct 15, 2021
1 parent a889d0c commit 58cd55d
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 58cd55d

Please sign in to comment.