Skip to content

Commit c3a7c14

Browse files
author
Edvin N
authored
Increase ReadTimeout for Gin server (#64)
* Increase ReadTimeout for Gin server This to be able to support larger git repos that takes more then 5s to clone * Bump golangci-lint github action * Bump golangci-lint to 1.51.2 in github action
1 parent 18ae57f commit c3a7c14

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.github/workflows/go.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
with:
1717
go-version: 1.19
1818
- name: golangci-lint
19-
uses: golangci/golangci-lint-action@v2.5.2
19+
uses: golangci/golangci-lint-action@v3.4.0
2020
with:
21-
version: v1.46.2
21+
version: v1.51.2
2222
test:
2323
runs-on: ubuntu-latest
2424
steps:

pkg/server/server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ func NewServer(logger logr.Logger, addr string, authz *auth.Authorizer) *Server
2323
router.GET("/readyz", readinessHandler)
2424
router.GET("/healthz", livenessHandler)
2525
router.NoRoute(proxyHandler(authz))
26-
srv := &http.Server{ReadTimeout: 5 * time.Second, Addr: addr, Handler: router}
26+
// The ReadTimeout is set to 5 min make sure that strange requests don't live forever
27+
// But in general the external request should set a good timeout value for it's request.
28+
srv := &http.Server{ReadTimeout: 5 * time.Minute, Addr: addr, Handler: router}
2729
return &Server{
2830
srv: srv,
2931
}

0 commit comments

Comments
 (0)