Skip to content

Commit

Permalink
refactor: optimize _execDelete
Browse files Browse the repository at this point in the history
Signed-off-by: mlycore <[email protected]>
  • Loading branch information
mlycore committed Nov 15, 2023
1 parent 9f2adc9 commit cab8969
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pitr/cli/internal/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cab8969

Please sign in to comment.