Skip to content

Commit a5cc0a9

Browse files
authored
Add read and write timeout to HTTP server
1 parent 3f99573 commit a5cc0a9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cmd/api/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ func run() error {
8989
srv := &http.Server{
9090
Addr: fmt.Sprintf("%s:%d", config.ApplicationConfig.Host, config.ApplicationConfig.Port),
9191
Handler: sdk.Runtime.GetEngine(),
92+
ReadTimeout: time.Duration(config.ApplicationConfig.ReadTimeout) * time.Second,
93+
WriteTimeout: time.Duration(config.ApplicationConfig.WriterTimeout) * time.Second,
9294
}
9395

9496
go func() {

0 commit comments

Comments
 (0)