From 95720ededda8ba517c2ef856cd900eaffdfbebe5 Mon Sep 17 00:00:00 2001 From: matst80 Date: Wed, 13 Nov 2024 09:02:57 +0100 Subject: [PATCH] only ask for confirmation if healthy --- synced-pool.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/synced-pool.go b/synced-pool.go index 75faee8..38bf8e4 100644 --- a/synced-pool.go +++ b/synced-pool.go @@ -107,7 +107,7 @@ func (p *SyncedPool) GrainOwnerChangeHandler(data []byte) (PoolMessage, []byte, host := idAndHostParts[1] log.Printf("Handling remote grain owner change to %s for id %s\n", host, id) for _, r := range p.remotes { - if r.Host == host { + if r.Host == host && r.IsHealthy() { // log.Printf("Remote grain %s changed to %s\n", id, host) go p.SpawnRemoteGrain(id, host) @@ -324,6 +324,9 @@ func (p *SyncedPool) RequestOwnership(id CartId) error { all := 0 p.mu.RLock() for _, r := range p.remotes { + if !r.IsHealthy() { + continue + } log.Printf("Asking for confirmation change of %s to %s (me) with %s\n", id, p.Hostname, r.Host) err := r.ConfirmChange(id, p.Hostname) all++