handle dead pools
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m47s

This commit is contained in:
matst80
2024-11-10 13:15:21 +01:00
parent 56f8a0b762
commit 7a57f2d451

View File

@@ -465,7 +465,14 @@ func (p *SyncedPool) getGrainPool(id CartId) (GrainPool, error) {
p.mu.RLock() p.mu.RLock()
remotePool, ok := p.remoteIndex[id] remotePool, ok := p.remoteIndex[id]
p.mu.RUnlock() 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() remoteLookupCount.Inc()
return remotePool, nil return remotePool, nil
} }