From cab8969a1ce079fc2e028e6deeee134cf2e97d49 Mon Sep 17 00:00:00 2001 From: mlycore Date: Wed, 15 Nov 2023 15:56:24 +0800 Subject: [PATCH] refactor: optimize _execDelete Signed-off-by: mlycore --- pitr/cli/internal/cmd/delete.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pitr/cli/internal/cmd/delete.go b/pitr/cli/internal/cmd/delete.go index b25e4436..2bbe97b0 100644 --- a/pitr/cli/internal/cmd/delete.go +++ b/pitr/cli/internal/cmd/delete.go @@ -149,17 +149,15 @@ func _execDelete(lsBackup *model.LsBackup) error { pw := prettyoutput.NewPW(totalNum) go pw.Render() - for _, sn := range lsBackup.SsBackup.StorageNodes { - sn := sn - dn, ok := dataNodeMap[sn.IP] - if !ok { + for _, storagenode := range lsBackup.SsBackup.StorageNodes { + sn := storagenode + if dn, ok := dataNodeMap[sn.IP]; !ok { logging.Warn(fmt.Sprintf("SKIPPED! data node %s:%d not found in backup info.", sn.IP, sn.Port)) - logging.Error(fmt.Sprintf("dnmap: %#v, sn: %v\n", dataNodeMap, sn.IP)) continue + } else { + as := pkg.NewAgentServer(fmt.Sprintf("%s:%d", convertLocalhost(sn.IP), AgentPort)) + go doDelete(as, sn, dn, resultCh, pw) } - as := pkg.NewAgentServer(fmt.Sprintf("%s:%d", convertLocalhost(sn.IP), AgentPort)) - - go doDelete(as, sn, dn, resultCh, pw) } time.Sleep(time.Millisecond * 100)