Skip to content

Commit

Permalink
Increase ReadTimeout for Gin server (#64)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Edvin N authored Mar 2, 2023
1 parent 18ae57f commit c3a7c14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.5.2
uses: golangci/golangci-lint-action@v3.4.0
with:
version: v1.46.2
version: v1.51.2
test:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 3 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ func NewServer(logger logr.Logger, addr string, authz *auth.Authorizer) *Server
router.GET("/readyz", readinessHandler)
router.GET("/healthz", livenessHandler)
router.NoRoute(proxyHandler(authz))
srv := &http.Server{ReadTimeout: 5 * time.Second, Addr: addr, Handler: router}
// The ReadTimeout is set to 5 min make sure that strange requests don't live forever
// But in general the external request should set a good timeout value for it's request.
srv := &http.Server{ReadTimeout: 5 * time.Minute, Addr: addr, Handler: router}
return &Server{
srv: srv,
}
Expand Down

0 comments on commit c3a7c14

Please sign in to comment.