sync request ownership
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 2m8s

This commit is contained in:
matst80
2024-11-11 23:48:33 +01:00
parent 2022d318ad
commit 98a4d9b1c6

View File

@@ -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 {