Skip to content

Commit

Permalink
Don't set server#WriteTimeout
Browse files Browse the repository at this point in the history
Setting `10s` as a write timeout might not cause any problems when the
request is processed successfully, but when we e.g. have to retry any
database errors, which is `5m` by default, this will just in an i/o
timeout and the listener won't event write any hints about that, but will
silently abort the connections.
  • Loading branch information
yhabteab committed Jul 16, 2024
1 parent 7145e10 commit 9bc1a5e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/listener/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ func (l *Listener) Run(ctx context.Context) error {
listenAddr := daemon.Config().Listen
l.logger.Infof("Starting listener on http://%s", listenAddr)
server := &http.Server{
Addr: listenAddr,
Handler: l,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 30 * time.Second,
Addr: listenAddr,
Handler: l,
ReadTimeout: 10 * time.Second,
IdleTimeout: 30 * time.Second,
}

serverErr := make(chan error)
Expand Down

0 comments on commit 9bc1a5e

Please sign in to comment.