Skip to content

Commit

Permalink
backend: add request timeouts to server
Browse files Browse the repository at this point in the history
This commit adds IdleTimeout, ReadTimeout, and WriteTimeout to the
server.
  • Loading branch information
chee-zaram committed Dec 19, 2023
1 parent 2932e0b commit 7fdd3a9
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 7fdd3a9

Please sign in to comment.