修复优雅重启不生效
This commit is contained in:
1 parent
d39faa1aca
commit
e6f4fac859
1 file changed
+3
-2
+3
-2
@@ -113,8 +113,6 @@ func run() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
go func() {
|
||||
// 服务连接
|
||||
@@ -141,6 +139,9 @@ func run() error {
|
||||
quit := make(chan os.Signal)
|
||||
signal.Notify(quit, os.Interrupt)
|
||||
<-quit
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
fmt.Printf("%s Shutdown Server ... \r\n", pkg.GetCurrentTimeStr())
|
||||
|
||||
if err := srv.Shutdown(ctx); err != nil {
|
||||
|
||||
Reference in new issue
Block a user