diff --git a/app/shutdown.go b/app/shutdown.go index 226f695..c8095e0 100644 --- a/app/shutdown.go +++ b/app/shutdown.go @@ -76,11 +76,11 @@ func listenShutDownSign(ctx context.Context, httpSrv *http.Server){ // 发送应用退出信号 sendAppStop() - // 关闭http服务 - httpSrv.Shutdown(ctx) - //处理后置操作等待结束 appDeferDo(ctx) + + // 关闭http服务 + httpSrv.Shutdown(ctx) } } @@ -88,9 +88,9 @@ func listenShutDownSign(ctx context.Context, httpSrv *http.Server){ func sendAppStop(){ for _,stopSigItem:=range exitWaitHandler.stopSignList{ - go func(sig chan StopSignal) { - sig<-StopSignal(1) - }(stopSigItem) + go func(sig chan StopSignal) { + sig<-StopSignal(1) + }(stopSigItem) } } @@ -101,7 +101,6 @@ func appDeferDo(ctx context.Context){ if maxTimeout == 0{ maxTimeout = 90 } - maxTimeoutContext,_:= context.WithTimeout(ctx, time.Duration(maxTimeout)*time.Second) select{ case <-maxTimeoutContext.Done():