From 138fddee3dc30b49e78ffef63c51706f1463a021 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 27 三月 2024 19:37:25 +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