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
|
||||
}
|
||||
|
||||
func (p *RemoteGrainPool) findOrCreateGrain(id CartId) *RemoteGrain {
|
||||
grain := p.findRemoteGrain(id)
|
||||
if grain == nil {
|
||||
grain = NewRemoteGrain(id, p.Host)
|
||||
p.mu.Lock()
|
||||
p.grains[id] = grain
|
||||
p.mu.Unlock()
|
||||
grain.Connect()
|
||||
}
|
||||
return grain
|
||||
}
|
||||
// func (p *RemoteGrainPool) findOrCreateGrain(id CartId) *RemoteGrain {
|
||||
// grain := p.findRemoteGrain(id)
|
||||
// if grain == nil {
|
||||
// grain = NewRemoteGrain(id, p.Host)
|
||||
// p.mu.Lock()
|
||||
// p.grains[id] = grain
|
||||
// p.mu.Unlock()
|
||||
// grain.Connect()
|
||||
// }
|
||||
// return grain
|
||||
// }
|
||||
|
||||
func (p *RemoteGrainPool) Process(id CartId, messages ...Message) ([]byte, error) {
|
||||
var result []byte
|
||||
var err error
|
||||
grain := p.findOrCreateGrain(id)
|
||||
grain := p.findRemoteGrain(id)
|
||||
if grain == nil {
|
||||
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) {
|
||||
grain := p.findOrCreateGrain(id)
|
||||
grain := p.findRemoteGrain(id)
|
||||
if grain == nil {
|
||||
return nil, fmt.Errorf("grain not found")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user