Skip to content

Commit

Permalink
when serverID is empty, execute remoteCall directly. Avoid executing …
Browse files Browse the repository at this point in the history
…sd.GetServer() once
  • Loading branch information
chgz committed Jun 21, 2021
1 parent e0bd8fa commit ad53fb0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion service/remote.go
Expand Up @@ -205,9 +205,12 @@ func (r *RemoteService) DoRPC(ctx context.Context, serverID string, route *route
Route: route.Short(),
Data: protoData,
}
if serverID == "" {
return r.remoteCall(ctx, nil, protos.RPCType_User, route, nil, msg)
}

target, _ := r.serviceDiscovery.GetServer(serverID)
if serverID != "" && target == nil {
if target == nil {
return nil, constants.ErrServerNotFound
}

Expand Down

0 comments on commit ad53fb0

Please sign in to comment.