dont create remote grains
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m41s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m41s
This commit is contained in:
26
rpc-pool.go
26
rpc-pool.go
@@ -114,22 +114,22 @@ func (p *RemoteGrainPool) findRemoteGrain(id CartId) *RemoteGrain {
|
|||||||
return grain
|
return grain
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *RemoteGrainPool) findOrCreateGrain(id CartId) *RemoteGrain {
|
// func (p *RemoteGrainPool) findOrCreateGrain(id CartId) *RemoteGrain {
|
||||||
grain := p.findRemoteGrain(id)
|
// grain := p.findRemoteGrain(id)
|
||||||
if grain == nil {
|
// if grain == nil {
|
||||||
grain = NewRemoteGrain(id, p.Host)
|
// grain = NewRemoteGrain(id, p.Host)
|
||||||
p.mu.Lock()
|
// p.mu.Lock()
|
||||||
p.grains[id] = grain
|
// p.grains[id] = grain
|
||||||
p.mu.Unlock()
|
// p.mu.Unlock()
|
||||||
grain.Connect()
|
// grain.Connect()
|
||||||
}
|
// }
|
||||||
return grain
|
// return grain
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (p *RemoteGrainPool) Process(id CartId, messages ...Message) ([]byte, error) {
|
func (p *RemoteGrainPool) Process(id CartId, messages ...Message) ([]byte, error) {
|
||||||
var result []byte
|
var result []byte
|
||||||
var err error
|
var err error
|
||||||
grain := p.findOrCreateGrain(id)
|
grain := p.findRemoteGrain(id)
|
||||||
if grain == nil {
|
if grain == nil {
|
||||||
return nil, fmt.Errorf("grain not found")
|
return nil, fmt.Errorf("grain not found")
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ func (p *RemoteGrainPool) Process(id CartId, messages ...Message) ([]byte, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *RemoteGrainPool) Get(id CartId) ([]byte, error) {
|
func (p *RemoteGrainPool) Get(id CartId) ([]byte, error) {
|
||||||
grain := p.findOrCreateGrain(id)
|
grain := p.findRemoteGrain(id)
|
||||||
if grain == nil {
|
if grain == nil {
|
||||||
return nil, fmt.Errorf("grain not found")
|
return nil, fmt.Errorf("grain not found")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user