1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-27 09:11:53 -05:00

Make git batch operations use parent context timeout instead of default timeout (#26325) (#26330)

Backport #26325 by @wxiaoguang

Fix #26064

Some git commands should use parent context, otherwise it would exit too
early (by the default timeout, 10m), and the "cmd.Wait" waits till the
pipes are closed.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 9451781ebe)
This commit is contained in:
Giteabot 2023-08-04 21:44:25 +08:00 committed by Earl Warren
parent 5aa6a8288d
commit e5c26e38f5
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -74,6 +74,8 @@ func CatFileBatchCheck(ctx context.Context, repoPath string) (WriteCloserError,
Stdin: batchStdinReader, Stdin: batchStdinReader,
Stdout: batchStdoutWriter, Stdout: batchStdoutWriter,
Stderr: &stderr, Stderr: &stderr,
UseContextTimeout: true,
}) })
if err != nil { if err != nil {
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String())) _ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
@ -124,6 +126,8 @@ func CatFileBatch(ctx context.Context, repoPath string) (WriteCloserError, *bufi
Stdin: batchStdinReader, Stdin: batchStdinReader,
Stdout: batchStdoutWriter, Stdout: batchStdoutWriter,
Stderr: &stderr, Stderr: &stderr,
UseContextTimeout: true,
}) })
if err != nil { if err != nil {
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String())) _ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))