Merge pull request #592 from unistack-org/speedup
changes to minimize allocations and provide useful info
This commit is contained in:
commit
d4fefc4b76
@ -280,16 +280,16 @@ func (r *rpcClient) next(request Request, opts CallOptions) (selector.Next, erro
|
|||||||
|
|
||||||
// return remote address
|
// return remote address
|
||||||
if len(opts.Address) > 0 {
|
if len(opts.Address) > 0 {
|
||||||
var nodes []*registry.Node
|
nodes := make([]*registry.Node, len(opts.Address))
|
||||||
|
|
||||||
for _, address := range opts.Address {
|
for i, address := range opts.Address {
|
||||||
nodes = append(nodes, ®istry.Node{
|
nodes[i] = ®istry.Node{
|
||||||
Address: address,
|
Address: address,
|
||||||
// Set the protocol
|
// Set the protocol
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"protocol": "mucp",
|
"protocol": "mucp",
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// crude return method
|
// crude return method
|
||||||
|
@ -405,6 +405,7 @@ func (s *rpcServer) Register() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Logf("Subscribing %s to topic: %s", node.Id, sub.Topic())
|
||||||
s.subscribers[sb] = []broker.Subscriber{sub}
|
s.subscribers[sb] = []broker.Subscriber{sub}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +466,7 @@ func (s *rpcServer) Deregister() error {
|
|||||||
|
|
||||||
for sb, subs := range s.subscribers {
|
for sb, subs := range s.subscribers {
|
||||||
for _, sub := range subs {
|
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()
|
sub.Unsubscribe()
|
||||||
}
|
}
|
||||||
s.subscribers[sb] = nil
|
s.subscribers[sb] = nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user