fix: 解决备份账号异常导致备份记录无法删除的问题 (#3922)

Refs #3919
This commit is contained in:
ssongliu 2024-02-20 15:02:07 +08:00 committed by GitHub
parent 1781362342
commit e346442d36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -268,11 +268,13 @@ func (u *BackupService) BatchDeleteRecord(ids []uint) error {
for _, record := range records {
backupAccount, err := backupRepo.Get(commonRepo.WithByType(record.Source))
if err != nil {
return err
global.LOG.Errorf("load backup account %s info from db failed, err: %v", record.Source, err)
continue
}
client, err := u.NewClient(&backupAccount)
if err != nil {
return err
global.LOG.Errorf("new client for backup account %s failed, err: %v", record.Source, err)
continue
}
if _, err = client.Delete(path.Join(record.FileDir, record.FileName)); err != nil {
global.LOG.Errorf("remove file %s from %s failed, err: %v", path.Join(record.FileDir, record.FileName), record.Source, err)