From 98a4d9b1c660fdb7234c124ee3c781849e40be1e Mon Sep 17 00:00:00 2001 From: matst80 Date: Mon, 11 Nov 2024 23:48:33 +0100 Subject: [PATCH] sync request ownership --- synced-pool.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/synced-pool.go b/synced-pool.go index ff99eec..a120751 100644 --- a/synced-pool.go +++ b/synced-pool.go @@ -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 {