更新下载超时延长

This commit is contained in:
2026-07-09 19:38:30 +08:00
parent bfd8c2acd5
commit 21cca6513b
+8 -1
View File
@@ -795,7 +795,14 @@ func (c *Client) pollVideo(ctx context.Context, sess *tlsSession, token, pollURL
// asset is already produced at this point, so a transient network hiccup // asset is already produced at this point, so a transient network hiccup
// (connection EOF/reset mid-body, S3 accelerate 5xx) must not fail the whole // (connection EOF/reset mid-body, S3 accelerate 5xx) must not fail the whole
// generation — retry with backoff before giving up. // generation — retry with backoff before giving up.
func (c *Client) download(ctx context.Context, sess *tlsSession, url string) ([]byte, error) { const downloadTimeout = 3 * time.Minute
func (c *Client) download(parent context.Context, sess *tlsSession, url string) ([]byte, error) {
// The artifact is already produced; detach from the (often nearly-elapsed)
// generation ctx deadline/cancel and give the download its own budget so a
// slow CDN read isn't killed mid-body and the backoff-retries can actually run.
ctx, cancel := context.WithTimeout(context.WithoutCancel(parent), downloadTimeout)
defer cancel()
var data []byte var data []byte
var err error var err error
for _, wait := range []time.Duration{0, 1 * time.Second, 2 * time.Second, 5 * time.Second, 10 * time.Second} { for _, wait := range []time.Duration{0, 1 * time.Second, 2 * time.Second, 5 * time.Second, 10 * time.Second} {