update micro to v3.1.1

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-01-16 00:28:10 +03:00
parent 6ecfe94e7b
commit 4e2f984088
3 changed files with 17 additions and 17 deletions

4
go.mod
View File

@ -1,9 +1,9 @@
module github.com/unistack-org/micro-server-http module github.com/unistack-org/micro-server-http/v3
go 1.13 go 1.13
require ( require (
github.com/unistack-org/micro/v3 v3.0.2-0.20201215085205-f14efa64f09f github.com/unistack-org/micro/v3 v3.1.1
golang.org/x/net v0.0.0-20200904194848-62affa334b73 golang.org/x/net v0.0.0-20200904194848-62affa334b73
) )

4
go.sum
View File

@ -257,8 +257,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7/go.mod h1:imsgLplxEC/etjIhdr3dNzV3JeT27LbVu5pYWm0JCBY= github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7/go.mod h1:imsgLplxEC/etjIhdr3dNzV3JeT27LbVu5pYWm0JCBY=
github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY= github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY=
github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g=
github.com/unistack-org/micro/v3 v3.0.2-0.20201215085205-f14efa64f09f h1:jrFuYrQQuSGgODMWE2mwiUjeLxbUDrAQtGjVAnN4PUU= github.com/unistack-org/micro/v3 v3.1.1 h1:kWL0BVzUBdotjfDbl1qL9lNYmZqvebQWPNCyqrjUSAk=
github.com/unistack-org/micro/v3 v3.0.2-0.20201215085205-f14efa64f09f/go.mod h1:0DgOy4OdJxQCDER8YSKitZugd2+1bddrRSNfeooTHDc= github.com/unistack-org/micro/v3 v3.1.1/go.mod h1:0DgOy4OdJxQCDER8YSKitZugd2+1bddrRSNfeooTHDc=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA= github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=

26
http.go
View File

@ -157,7 +157,7 @@ func (h *httpServer) Register() error {
if !registered { if !registered {
if config.Logger.V(logger.InfoLevel) { if config.Logger.V(logger.InfoLevel) {
config.Logger.Infof("Registry [%s] Registering node: %s", config.Registry.String(), service.Nodes[0].Id) config.Logger.Infof(config.Context, "Registry [%s] Registering node: %s", config.Registry.String(), service.Nodes[0].Id)
} }
} }
@ -212,7 +212,7 @@ func (h *httpServer) Deregister() error {
} }
if config.Logger.V(logger.InfoLevel) { if config.Logger.V(logger.InfoLevel) {
config.Logger.Infof("Deregistering node: %s", service.Nodes[0].Id) config.Logger.Infof(config.Context, "Deregistering node: %s", service.Nodes[0].Id)
} }
if err := server.DefaultDeregisterFunc(service, config); err != nil { if err := server.DefaultDeregisterFunc(service, config); err != nil {
@ -236,9 +236,9 @@ func (h *httpServer) Deregister() error {
} }
for _, sub := range subs { for _, sub := range subs {
config.Logger.Infof("Unsubscribing from topic: %s", sub.Topic()) config.Logger.Infof(config.Context, "Unsubscribing from topic: %s", sub.Topic())
if err := sub.Unsubscribe(subCtx); err != nil { if err := sub.Unsubscribe(subCtx); err != nil {
config.Logger.Errorf("failed to unsubscribe topic: %s, error: %v", sb.Topic(), err) config.Logger.Errorf(config.Context, "failed to unsubscribe topic: %s, error: %v", sb.Topic(), err)
return err return err
} }
} }
@ -283,7 +283,7 @@ func (h *httpServer) Start() error {
} }
if config.Logger.V(logger.InfoLevel) { if config.Logger.V(logger.InfoLevel) {
config.Logger.Infof("Listening on %s", ts.Addr().String()) config.Logger.Infof(config.Context, "Listening on %s", ts.Addr().String())
} }
h.Lock() h.Lock()
@ -301,7 +301,7 @@ func (h *httpServer) Start() error {
if err := config.RegisterCheck(h.opts.Context); err != nil { if err := config.RegisterCheck(h.opts.Context); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf("Server %s-%s register check error: %s", config.Name, config.Id, err) config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s", config.Name, config.Id, err)
} }
} else { } else {
if err = h.Register(); err != nil { if err = h.Register(); err != nil {
@ -334,28 +334,28 @@ func (h *httpServer) Start() error {
rerr := config.RegisterCheck(h.opts.Context) rerr := config.RegisterCheck(h.opts.Context)
if rerr != nil && registered { if rerr != nil && registered {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf("Server %s-%s register check error: %s, deregister it", config.Name, config.Id, rerr) config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s, deregister it", config.Name, config.Id, rerr)
} }
// deregister self in case of error // deregister self in case of error
if err := h.Deregister(); err != nil { if err := h.Deregister(); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf("Server %s-%s deregister error: %s", config.Name, config.Id, err) config.Logger.Errorf(config.Context, "Server %s-%s deregister error: %s", config.Name, config.Id, err)
} }
} }
} else if rerr != nil && !registered { } else if rerr != nil && !registered {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf("Server %s-%s register check error: %s", config.Name, config.Id, rerr) config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s", config.Name, config.Id, rerr)
} }
continue continue
} }
if err := h.Register(); err != nil { if err := h.Register(); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf("Server %s-%s register error: %s", config.Name, config.Id, err) config.Logger.Errorf(config.Context, "Server %s-%s register error: %s", config.Name, config.Id, err)
} }
} }
if err := h.Register(); err != nil { if err := h.Register(); err != nil {
config.Logger.Errorf("Server register error: %s", err) config.Logger.Errorf(config.Context, "Server register error: %s", err)
} }
// wait for exit // wait for exit
case ch = <-h.exit: case ch = <-h.exit:
@ -367,11 +367,11 @@ func (h *httpServer) Start() error {
// deregister // deregister
if err := h.Deregister(); err != nil { if err := h.Deregister(); err != nil {
config.Logger.Errorf("Server deregister error: %s", err) config.Logger.Errorf(config.Context, "Server deregister error: %s", err)
} }
if err := config.Broker.Disconnect(config.Context); err != nil { if err := config.Broker.Disconnect(config.Context); err != nil {
config.Logger.Errorf("Broker disconnect error: %s", err) config.Logger.Errorf(config.Context, "Broker disconnect error: %s", err)
} }
}() }()