From 6cce6de2161840f77d397fe25bee6096d0eb9877 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 22 三月 2024 19:37:21 +0800 Subject: [PATCH] 物料搜索接口 --- main.go | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 4227511..96befda 100644 --- a/main.go +++ b/main.go @@ -6,10 +6,10 @@ "os" "os/signal" "outsourcing/conf" - "outsourcing/constvar" "outsourcing/models" "outsourcing/pkg/logx" "outsourcing/router" + "outsourcing/service" "syscall" "time" ) @@ -38,18 +38,14 @@ ReadTimeout: 5 * time.Second, WriteTimeout: 5 * time.Second, } + go service.InitApsServiceConn() go shutdown(server) - logx.Error(server.ListenAndServe().Error()) } func shutdown(server *http.Server) { quit := make(chan os.Signal, 1) signal.Notify(quit, syscall.SIGKILL, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGTERM) <-quit - - if constvar.GrpcClient != nil { - _ = constvar.GrpcClient.Close() - } // 鍒涘缓涓�涓笂涓嬫枃锛岃缃秴鏃舵椂闂� ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -58,5 +54,8 @@ logx.Warnf("鏈嶅姟浼橀泤閫�鍑哄け璐�: %v", err) return } + + service.CloseApsServiceConn() + logx.Infof("server exited success") } -- Gitblit v1.8.0