Skip to content

Commit

Permalink
fix getBackup panic if pass a invalid backup ID (#424)
Browse files Browse the repository at this point in the history
Signed-off-by: wayblink <anyang.wang@zilliz.com>
  • Loading branch information
wayblink authored Sep 12, 2024
1 parent 7aad2e6 commit ab69696
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/backup_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,13 +647,13 @@ func (b *BackupContext) GetRestore(ctx context.Context, request *backuppb.GetRes
}

task := b.meta.GetRestoreTask(request.GetId())
progress := int32(float32(task.GetRestoredSize()) * 100 / float32(task.GetToRestoreSize()))
// don't return zero
if progress == 0 {
progress = 1
}
task.Progress = progress
if task != nil {
progress := int32(float32(task.GetRestoredSize()) * 100 / float32(task.GetToRestoreSize()))
// don't return zero
if progress == 0 {
progress = 1
}
task.Progress = progress
resp.Code = backuppb.ResponseCode_Success
resp.Msg = "success"
resp.Data = task
Expand Down

0 comments on commit ab69696

Please sign in to comment.