From 7a57f2d451b1c3942029d39b91f6ade32b313177 Mon Sep 17 00:00:00 2001 From: matst80 Date: Sun, 10 Nov 2024 13:15:21 +0100 Subject: [PATCH] handle dead pools --- synced-pool.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/synced-pool.go b/synced-pool.go index b8b5914..07f60ff 100644 --- a/synced-pool.go +++ b/synced-pool.go @@ -465,7 +465,14 @@ func (p *SyncedPool) getGrainPool(id CartId) (GrainPool, error) { p.mu.RLock() remotePool, ok := p.remoteIndex[id] p.mu.RUnlock() - if ok && remotePool != nil { + if ok { + if remotePool == nil { + p.mu.Lock() + delete(p.remoteIndex, id) + p.mu.Unlock() + return nil, fmt.Errorf("remote pool is nil", id) + + } remoteLookupCount.Inc() return remotePool, nil }