Skip to content

Commit fb22fbd

Browse files
committed
fix(httpclient): raise image-host upload deadline to 120s
The whole-request deadline for image hosting was 60s. A 2160p screenshot failed against reelflix with: Post "https://img.reelflix.cc/api/1/upload": context deadline exceeded (Client.Timeout exceeded while awaiting headers) "while awaiting headers" means the body was already sent and the deadline expired waiting on the host to answer, so this is host processing time rather than local transfer. The same batch reported mean_attempt_duration=42.02s across 6 attempts, and since failed attempts are timed too, the 5 successes averaged around 38s. That leaves barely 1.5x headroom against a 60s ceiling for an operation with a long tail. 120s restores roughly 3x headroom. UploadTimeout is consumed only by internal/imagehosting; every tracker upload path uses DefaultTimeout, so this does not widen any other deadline.
1 parent d4ded9d commit fb22fbd

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/httpclient/httpclient.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ import (
1111
const (
1212
// DefaultTimeout and UploadTimeout are whole-request deadlines assigned to [http.Client.Timeout].
1313
DefaultTimeout = 45 * time.Second
14-
UploadTimeout = 60 * time.Second
14+
// UploadTimeout covers image-host uploads, where the deadline spans the host
15+
// processing a multi-megabyte image and not just the transfer. 2160p
16+
// screenshots run 5-8MB and hosts have been observed answering well past a
17+
// minute under load, so this keeps roughly three times the headroom over
18+
// their typical response time.
19+
UploadTimeout = 120 * time.Second
1520
)
1621

1722
// New returns a client whose timeout defaults to [DefaultTimeout] when timeout is non-positive.

0 commit comments

Comments
 (0)