safe truncation
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 27s
Build and Publish / BuildAndDeploy (push) Successful in 2m19s

This commit is contained in:
matst80
2024-11-12 20:51:39 +01:00
parent 983d1d52ae
commit 39244350e8
3 changed files with 26 additions and 11 deletions

View File

@@ -255,14 +255,19 @@ func (p *SyncedPool) ExcludeKnown(hosts []string) []string {
}
func (p *SyncedPool) RemoveHost(host *RemoteHost) {
for i, r := range p.remotes {
toKeep := make([]*RemoteHost, 0, len(p.remotes))
for _, r := range p.remotes {
if r == host {
p.RemoveHostMappedCarts(r)
p.remotes = append(p.remotes[:i], p.remotes[i+1:]...)
connectedRemotes.Set(float64(len(p.remotes)))
return
} else {
toKeep = append(toKeep, r)
}
}
p.remotes = toKeep
connectedRemotes.Set(float64(len(p.remotes)))
}
func (p *SyncedPool) RemoveHostMappedCarts(host *RemoteHost) {