less ownership requests
This commit is contained in:
@@ -448,7 +448,7 @@ func (p *SyncedPool) AddRemote(host string) error {
|
|||||||
Host: host,
|
Host: host,
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
for range time.Tick(time.Second * 10) {
|
for range time.Tick(time.Second * 3) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
err = remote.Ping()
|
err = remote.Ping()
|
||||||
@@ -481,9 +481,9 @@ func (p *SyncedPool) getGrain(id CartId, requestOwnership bool) (Grain, error) {
|
|||||||
remoteLookupCount.Inc()
|
remoteLookupCount.Inc()
|
||||||
return remoteGrain, nil
|
return remoteGrain, nil
|
||||||
}
|
}
|
||||||
|
if requestOwnership {
|
||||||
go p.RequestOwnership(id)
|
go p.RequestOwnership(id)
|
||||||
|
}
|
||||||
localGrain, err = p.local.GetGrain(id)
|
localGrain, err = p.local.GetGrain(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -516,5 +516,10 @@ func (p *SyncedPool) Get(id CartId) (*CallResult, error) {
|
|||||||
if remoteGrain, ok := grain.(*RemoteGrain); ok {
|
if remoteGrain, ok := grain.(*RemoteGrain); ok {
|
||||||
return remoteGrain.GetCurrentState()
|
return remoteGrain.GetCurrentState()
|
||||||
}
|
}
|
||||||
|
if localGrain, ok := grain.(*CartGrain); ok {
|
||||||
|
if len(localGrain.storageMessages) > 0 {
|
||||||
|
go p.RequestOwnership(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
return grain.GetCurrentState()
|
return grain.GetCurrentState()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user