Skip to content

Commit

Permalink
feat: support exit timeout (#2342)
Browse files Browse the repository at this point in the history
Signed-off-by: yisaer <[email protected]>
  • Loading branch information
Yisaer authored Oct 20, 2023
1 parent 4aa306c commit 7f13cb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ func StartUp(Version string) {
<-sigint
exit <- struct{}{}

if err = srvRest.Shutdown(context.TODO()); err != nil {
ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second)
defer cancel()
if err = srvRest.Shutdown(ctx); err != nil {
logger.Errorf("rest server shutdown error: %v", err)
}
logger.Info("rest server successfully shutdown.")
Expand Down

0 comments on commit 7f13cb8

Please sign in to comment.