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++
}
if ok == 0 && all > 0 {
delete(p.local.grains, id)
return fmt.Errorf("no remotes confirmed change")
}
if ok < (all / 2) {
delete(p.local.grains, id)
return fmt.Errorf("quorum not reached")
}
return nil
@@ -435,10 +437,7 @@ func (p *SyncedPool) getGrain(id CartId, requestOwnership bool) (Grain, error) {
return remoteGrain, nil
}
if requestOwnership {
err = p.RequestOwnership(id)
if err != nil {
return nil, err
}
go p.RequestOwnership(id)
}
localGrain, err = p.local.GetGrain(id)
if err != nil {