Skip to content

Commit

Permalink
backend: add request timeouts to server (#70)
Browse files Browse the repository at this point in the history
This commit adds IdleTimeout, ReadTimeout, and WriteTimeout to the
server configuration.
  • Loading branch information
chee-zaram authored Dec 19, 2023
1 parent 5998692 commit 1fcdf6a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/internal/api/v1/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ func SetAPIRouter(conf config.Config) *gin.Engine {
// This is to implement graceful shutdown.
func SetWebRouter(router *gin.Engine, conf config.Config) *http.Server {
return &http.Server{
Handler: router,
Addr: fmt.Sprintf("%s:%s", conf.GinHost, conf.GinPort),
Handler: router,
Addr: fmt.Sprintf("%s:%s", conf.GinHost, conf.GinPort),
IdleTimeout: 1 * time.Minute,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
}
}

Expand Down

0 comments on commit 1fcdf6a

Please sign in to comment.