safe truncation
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user