Skip to content

Commit

Permalink
changes to minimize allocations and provide useful info
Browse files Browse the repository at this point in the history
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
  • Loading branch information
vtolstov committed Jul 16, 2019
1 parent 8c7e35c commit a3bddf5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions client/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,16 @@ func (r *rpcClient) next(request Request, opts CallOptions) (selector.Next, erro

// return remote address
if len(opts.Address) > 0 {
var nodes []*registry.Node
nodes := make([]*registry.Node, len(opts.Address))

for _, address := range opts.Address {
nodes = append(nodes, &registry.Node{
for i, address := range opts.Address {
nodes[i] = &registry.Node{
Address: address,
// Set the protocol
Metadata: map[string]string{
"protocol": "mucp",
},
})
}
}

// crude return method
Expand Down
3 changes: 2 additions & 1 deletion server/rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ func (s *rpcServer) Register() error {
if err != nil {
return err
}
log.Logf("Subscribing %s to topic: %s", node.Id, sub.Topic())
s.subscribers[sb] = []broker.Subscriber{sub}
}

Expand Down Expand Up @@ -465,7 +466,7 @@ func (s *rpcServer) Deregister() error {

for sb, subs := range s.subscribers {
for _, sub := range subs {
log.Logf("Unsubscribing from topic: %s", sub.Topic())
log.Logf("Unsubscribing %s from topic: %s", node.Id, sub.Topic())
sub.Unsubscribe()
}
s.subscribers[sb] = nil
Expand Down

0 comments on commit a3bddf5

Please sign in to comment.