Skip to content

Commit

Permalink
[Bugfix] Don't multiple write timeout duration (#4506)
Browse files Browse the repository at this point in the history
Signed-off-by: James Phillips <[email protected]>
  • Loading branch information
jamesdphillips authored Nov 19, 2021
1 parent 87600b6 commit 3f13ae0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/apid/apid.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func New(c Config, opts ...Option) (*APId, error) {
a.HTTPServer = &http.Server{
Addr: c.ListenAddress,
Handler: router,
WriteTimeout: c.WriteTimeout * time.Second,
WriteTimeout: c.WriteTimeout,
ReadTimeout: 15 * time.Second,
TLSConfig: tlsServerConfig,
}
Expand Down Expand Up @@ -235,7 +235,7 @@ func GraphQLSubrouter(router *mux.Router, cfg Config) *mux.Router {
// The write timeout hangs up the request making it more difficult for
// clients to determine what occurred. As such give the service as much time
// as possible to produce results.
timeout := (cfg.WriteTimeout * time.Second) - (50 * time.Millisecond)
timeout := cfg.WriteTimeout - (50 * time.Millisecond)
if timeout < 0 {
timeout = 0
}
Expand Down

0 comments on commit 3f13ae0

Please sign in to comment.