Raise HTTP WriteTimeout above the request middleware timeout (closes #62) #72

Merged
sneak merged 1 commits from issue-62-write-timeout into main 2026-08-07 13:58:29 +02:00
Collaborator

Raise httpWriteTimeout in internal/server/http.go from 10s to 65 * time.Second so it comfortably exceeds the router's 60s requestTimeout. This makes the middleware.Timeout(60s) the effective request limit — a slow response now returns a clean 503 from the middleware instead of being cut at the socket write deadline by the transport.

httpReadTimeout stays at 10s. A comment on httpWriteTimeout documents that it must remain above the 60s request timeout. Change is confined to internal/server/http.go; routes.go is untouched.

Closes #62

Raise `httpWriteTimeout` in `internal/server/http.go` from 10s to `65 * time.Second` so it comfortably exceeds the router's 60s `requestTimeout`. This makes the `middleware.Timeout(60s)` the effective request limit — a slow response now returns a clean 503 from the middleware instead of being cut at the socket write deadline by the transport. `httpReadTimeout` stays at 10s. A comment on `httpWriteTimeout` documents that it must remain above the 60s request timeout. Change is confined to `internal/server/http.go`; `routes.go` is untouched. Closes #62
clawbot added 1 commit 2026-08-07 13:55:59 +02:00
Raise HTTP WriteTimeout above the request middleware timeout (closes #62)
All checks were successful
check / check (push) Successful in 5s
986729287a
Author
Collaborator

Change summary

Single file changed: internal/server/http.go

  • httpWriteTimeout raised from 10 * time.Second to 65 * time.Second
  • comment added explaining it must stay above the router's 60s requestTimeout so the middleware timeout fires first and returns a clean 503
  • httpReadTimeout unchanged (10s); routes.go untouched

Diff:

 	// httpWriteTimeout is the maximum duration before timing out
-	// writes of the response.
-	httpWriteTimeout = 10 * time.Second
+	// writes of the response. It must stay above the router's
+	// requestTimeout (60s, in routes.go) so the middleware timeout
+	// fires first and returns a clean 503, rather than the transport
+	// cutting the connection at the socket write deadline.
+	httpWriteTimeout = 65 * time.Second

Validation

docker build . (runs fmt-check, lint, test, build) exited 0:

docker build exit code: 0
#33 naming to docker.io/library/webhooker-issue62 done
### Change summary Single file changed: `internal/server/http.go` - `httpWriteTimeout` raised from `10 * time.Second` to `65 * time.Second` - comment added explaining it must stay above the router's 60s `requestTimeout` so the middleware timeout fires first and returns a clean 503 - `httpReadTimeout` unchanged (10s); `routes.go` untouched Diff: ``` // httpWriteTimeout is the maximum duration before timing out - // writes of the response. - httpWriteTimeout = 10 * time.Second + // writes of the response. It must stay above the router's + // requestTimeout (60s, in routes.go) so the middleware timeout + // fires first and returns a clean 503, rather than the transport + // cutting the connection at the socket write deadline. + httpWriteTimeout = 65 * time.Second ``` ### Validation `docker build .` (runs fmt-check, lint, test, build) exited 0: ``` docker build exit code: 0 #33 naming to docker.io/library/webhooker-issue62 done ```
Author
Collaborator

Independent review — PASS (merge-ready)

Adversarial review against the issue spec and repo policies.

  • internal/server/http.go: httpWriteTimeout raised from 10s to 65s, above the router's 60s requestTimeout, so middleware.Timeout(60s) fires first and returns a clean 503 instead of the transport cutting the response at the socket write deadline. Clear explanatory comment cross-referencing routes.go. httpReadTimeout left at 10s.
  • Scope limited to internal/server/http.go (+5/-2); routes.go untouched as instructed. docker build . green (fmt-check + lint + test + build). No AI/tooling references. Commit subject closes the issue.
  • No new test required: HTTP-server timeout behaviour is not meaningfully unit-testable without flakiness, and the existing server tests pass under the build.

Verdict: meets the bar. Marking merge-ready and handing to @sneak for final review.

## Independent review — PASS (merge-ready) Adversarial review against the issue spec and repo policies. - `internal/server/http.go`: `httpWriteTimeout` raised from 10s to 65s, above the router's 60s `requestTimeout`, so `middleware.Timeout(60s)` fires first and returns a clean 503 instead of the transport cutting the response at the socket write deadline. Clear explanatory comment cross-referencing `routes.go`. `httpReadTimeout` left at 10s. - Scope limited to `internal/server/http.go` (+5/-2); `routes.go` untouched as instructed. `docker build .` green (fmt-check + lint + test + build). No AI/tooling references. Commit subject closes the issue. - No new test required: HTTP-server timeout behaviour is not meaningfully unit-testable without flakiness, and the existing server tests pass under the build. Verdict: meets the bar. Marking merge-ready and handing to @sneak for final review.
sneak was assigned by clawbot 2026-08-07 13:56:48 +02:00
sneak merged commit 0c9c885d51 into main 2026-08-07 13:58:29 +02:00
sneak deleted branch issue-62-write-timeout 2026-08-07 13:58:29 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#72