fix map race condition in grpc server
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
6b5eb3555b
commit
704e7e3e94
8
grpc.go
8
grpc.go
@ -562,11 +562,17 @@ func (g *grpcServer) Register() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make copy of metadata
|
||||||
|
md := make(meta.Metadata)
|
||||||
|
for k, v := range config.Metadata {
|
||||||
|
md[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
// register service
|
// register service
|
||||||
node := ®istry.Node{
|
node := ®istry.Node{
|
||||||
Id: config.Name + "-" + config.Id,
|
Id: config.Name + "-" + config.Id,
|
||||||
Address: mnet.HostPort(addr, port),
|
Address: mnet.HostPort(addr, port),
|
||||||
Metadata: config.Metadata,
|
Metadata: md,
|
||||||
}
|
}
|
||||||
|
|
||||||
node.Metadata["broker"] = config.Broker.String()
|
node.Metadata["broker"] = config.Broker.String()
|
||||||
|
Loading…
Reference in New Issue
Block a user