sync request ownership
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 2m8s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 2m8s
This commit is contained in:
@@ -319,9 +319,11 @@ func (p *SyncedPool) RequestOwnership(id CartId) error {
|
|||||||
ok++
|
ok++
|
||||||
}
|
}
|
||||||
if ok == 0 && all > 0 {
|
if ok == 0 && all > 0 {
|
||||||
|
delete(p.local.grains, id)
|
||||||
return fmt.Errorf("no remotes confirmed change")
|
return fmt.Errorf("no remotes confirmed change")
|
||||||
}
|
}
|
||||||
if ok < (all / 2) {
|
if ok < (all / 2) {
|
||||||
|
delete(p.local.grains, id)
|
||||||
return fmt.Errorf("quorum not reached")
|
return fmt.Errorf("quorum not reached")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -435,10 +437,7 @@ func (p *SyncedPool) getGrain(id CartId, requestOwnership bool) (Grain, error) {
|
|||||||
return remoteGrain, nil
|
return remoteGrain, nil
|
||||||
}
|
}
|
||||||
if requestOwnership {
|
if requestOwnership {
|
||||||
err = p.RequestOwnership(id)
|
go p.RequestOwnership(id)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
localGrain, err = p.local.GetGrain(id)
|
localGrain, err = p.local.GetGrain(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user