remove local grains if they exist
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m52s

This commit is contained in:
matst80
2024-11-10 13:10:26 +01:00
parent c7a5e22471
commit 08b22316e5

View File

@@ -269,6 +269,10 @@ func (p *SyncedPool) handleConnection(conn net.Conn) {
found = true found = true
log.Printf("Remote grain %s changed to %s\n", idAndHostParts[0], idAndHostParts[1]) log.Printf("Remote grain %s changed to %s\n", idAndHostParts[0], idAndHostParts[1])
p.mu.Lock() p.mu.Lock()
if p.local.grains[ToCartId(idAndHostParts[0])] != nil {
log.Printf("Grain %s already exists locally, deleting\n", idAndHostParts[0])
delete(p.local.grains, ToCartId(idAndHostParts[0]))
}
p.remoteIndex[ToCartId(idAndHostParts[0])] = r.Pool p.remoteIndex[ToCartId(idAndHostParts[0])] = r.Pool
p.mu.Unlock() p.mu.Unlock()
} }