summaryrefslogtreecommitdiffstats
path: root/modules/git/batch_reader.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/batch_reader.go')
-rw-r--r--modules/git/batch_reader.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/git/batch_reader.go b/modules/git/batch_reader.go
index 5a0a82b13a..902fa89718 100644
--- a/modules/git/batch_reader.go
+++ b/modules/git/batch_reader.go
@@ -57,6 +57,12 @@ func CatFileBatchCheck(ctx context.Context, repoPath string) (WriteCloserError,
<-closed
}
+ // Ensure cancel is called as soon as the provided context is cancelled
+ go func() {
+ <-ctx.Done()
+ cancel()
+ }()
+
_, filename, line, _ := runtime.Caller(2)
filename = strings.TrimPrefix(filename, callerPrefix)
@@ -101,6 +107,12 @@ func CatFileBatch(ctx context.Context, repoPath string) (WriteCloserError, *bufi
<-closed
}
+ // Ensure cancel is called as soon as the provided context is cancelled
+ go func() {
+ <-ctx.Done()
+ cancel()
+ }()
+
_, filename, line, _ := runtime.Caller(2)
filename = strings.TrimPrefix(filename, callerPrefix)