diff --git a/app/comment/cmd/main.go b/app/comment/cmd/main.go index 99d5fea..7a530c7 100644 --- a/app/comment/cmd/main.go +++ b/app/comment/cmd/main.go @@ -5,6 +5,7 @@ import ( "ByteRhythm/app/comment/service" "ByteRhythm/config" "ByteRhythm/idl/comment/commentPb" + "github.com/go-micro/plugins/v4/registry/etcd" "fmt" @@ -18,6 +19,9 @@ func main() { dao.InitMySQL() dao.InitRedis() + defer dao.RedisNo1Client.Close() + defer dao.RedisNo2Client.Close() + // etcd注册件 etcdReg := etcd.NewRegistry( registry.Addrs(fmt.Sprintf("%s:%s", config.EtcdHost, config.EtcdPort)), diff --git a/app/favorite/cmd/main.go b/app/favorite/cmd/main.go index d261b82..db0e6a0 100644 --- a/app/favorite/cmd/main.go +++ b/app/favorite/cmd/main.go @@ -10,11 +10,12 @@ import ( "ByteRhythm/mq" "context" "fmt" + "os" + "github.com/go-micro/plugins/v4/registry/etcd" ratelimit "github.com/go-micro/plugins/v4/wrapper/ratelimiter/uber" "github.com/go-micro/plugins/v4/wrapper/select/roundrobin" "github.com/go-micro/plugins/v4/wrapper/trace/opentracing" - "os" "go-micro.dev/v4" "go-micro.dev/v4/registry" @@ -27,6 +28,8 @@ func main() { mq.InitRabbitMQ() loadingScript() + defer dao.RedisClient.Close() + // etcd注册件 etcdReg := etcd.NewRegistry( registry.Addrs(fmt.Sprintf("%s:%s", config.EtcdHost, config.EtcdPort)), diff --git a/app/message/cmd/main.go b/app/message/cmd/main.go index eaf6d1b..e08289c 100644 --- a/app/message/cmd/main.go +++ b/app/message/cmd/main.go @@ -7,11 +7,12 @@ import ( "ByteRhythm/config" "ByteRhythm/idl/message/messagePb" "fmt" + "os" + "github.com/go-micro/plugins/v4/registry/etcd" ratelimit "github.com/go-micro/plugins/v4/wrapper/ratelimiter/uber" "github.com/go-micro/plugins/v4/wrapper/select/roundrobin" "github.com/go-micro/plugins/v4/wrapper/trace/opentracing" - "os" "go-micro.dev/v4" "go-micro.dev/v4/registry" @@ -22,6 +23,8 @@ func main() { dao.InitMySQL() dao.InitRedis() + defer dao.RedisClient.Close() + // etcd注册件 etcdReg := etcd.NewRegistry( registry.Addrs(fmt.Sprintf("%s:%s", config.EtcdHost, config.EtcdPort)), diff --git a/app/relation/cmd/main.go b/app/relation/cmd/main.go index 7f81268..476c11e 100644 --- a/app/relation/cmd/main.go +++ b/app/relation/cmd/main.go @@ -7,11 +7,12 @@ import ( "ByteRhythm/config" "ByteRhythm/idl/relation/relationPb" "fmt" + "os" + "github.com/go-micro/plugins/v4/registry/etcd" ratelimit "github.com/go-micro/plugins/v4/wrapper/ratelimiter/uber" "github.com/go-micro/plugins/v4/wrapper/select/roundrobin" "github.com/go-micro/plugins/v4/wrapper/trace/opentracing" - "os" "go-micro.dev/v4" "go-micro.dev/v4/registry" @@ -22,6 +23,8 @@ func main() { dao.InitMySQL() dao.InitRedis() + defer dao.RedisClient.Close() + // etcd注册件 etcdReg := etcd.NewRegistry( registry.Addrs(fmt.Sprintf("%s:%s", config.EtcdHost, config.EtcdPort)), diff --git a/app/video/cmd/main.go b/app/video/cmd/main.go index 39050d6..dba81d2 100644 --- a/app/video/cmd/main.go +++ b/app/video/cmd/main.go @@ -26,6 +26,9 @@ func main() { dao.InitRedis() mq.InitRabbitMQ() loadingScript() + + defer dao.RedisClient.Close() + // etcd注册件 etcdReg := etcd.NewRegistry( registry.Addrs(fmt.Sprintf("%s:%s", config.EtcdHost, config.EtcdPort)), diff --git a/config/config.ini b/config/config.ini index 885e8fc..4648331 100644 --- a/config/config.ini +++ b/config/config.ini @@ -1,7 +1,7 @@ [Gin] AppMode = debug HttpHost = 0.0.0.0 -HttpPort = 4000 +HttpPort = 8080 [MySQL] DBHost = 127.0.0.1