mirror of https://github.com/go-gitea/gitea.git
Allow exit when caculating language in gogit version
This commit is contained in:
parent
57ba66822a
commit
9363b591ed
|
|
@ -59,6 +59,13 @@ func CalcLanguageStats(ctx context.Context, repo *git_module.Repository, commitI
|
||||||
firstExcludedLanguageSize := int64(0)
|
firstExcludedLanguageSize := int64(0)
|
||||||
|
|
||||||
err = tree.Files().ForEach(func(f *object.File) error {
|
err = tree.Files().ForEach(func(f *object.File) error {
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return ctx.Err()
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if f.Size == 0 {
|
if f.Size == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue