refactor everything again
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s
This commit is contained in:
12
rpc-pool.go
12
rpc-pool.go
@@ -24,19 +24,19 @@ func ToCartId(id string) CartId {
|
||||
|
||||
type RemoteGrain struct {
|
||||
*CartClient
|
||||
Id CartId
|
||||
Address string
|
||||
Id CartId
|
||||
Host string
|
||||
}
|
||||
|
||||
func NewRemoteGrain(id CartId, address string) (*RemoteGrain, error) {
|
||||
client, err := CartDial(fmt.Sprintf("%s:1337", address))
|
||||
func NewRemoteGrain(id CartId, host string) (*RemoteGrain, error) {
|
||||
client, err := CartDial(fmt.Sprintf("%s:1337", host))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &RemoteGrain{
|
||||
Id: id,
|
||||
Address: address,
|
||||
Host: host,
|
||||
CartClient: client,
|
||||
}, nil
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func (p *RemoteGrainPool) findRemoteGrain(id CartId) *RemoteGrain {
|
||||
p.mu.RLock()
|
||||
grain, ok := p.grains[id]
|
||||
p.mu.RUnlock()
|
||||
if !ok || grain == nil {
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return grain
|
||||
|
||||
Reference in New Issue
Block a user