|
|
@ -98,11 +98,15 @@ func main() { |
|
|
|
switch s { |
|
|
|
switch s { |
|
|
|
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT: |
|
|
|
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT: |
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 35*time.Second) |
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 35*time.Second) |
|
|
|
defer cancel() |
|
|
|
if err := grpcSrv.Shutdown(ctx); err != nil
|
|
|
|
grpcSrv.Shutdown(ctx) |
|
|
|
log.Error("grpcSrv.Shutdown error(%v)", err) |
|
|
|
httpSrv.Shutdown(ctx) |
|
|
|
} // grpc
|
|
|
|
|
|
|
|
if err := httpSrv.Shutdown(ctx); err != nil { |
|
|
|
|
|
|
|
log.Error("httpSrv.Shutdown error(%v)", err) |
|
|
|
|
|
|
|
} |
|
|
|
log.Info("{{.Name}} exit") |
|
|
|
log.Info("{{.Name}} exit") |
|
|
|
svc.Close() |
|
|
|
svc.Close() |
|
|
|
|
|
|
|
cancel() |
|
|
|
time.Sleep(time.Second) |
|
|
|
time.Sleep(time.Second) |
|
|
|
return |
|
|
|
return |
|
|
|
case syscall.SIGHUP: |
|
|
|
case syscall.SIGHUP: |
|
|
|