Skip to content

Commit

Permalink
Merge pull request #1662 from 0chain/fix/repairerr-check
Browse files Browse the repository at this point in the history
Add check for repair error
  • Loading branch information
dabasov authored Nov 4, 2024
2 parents 9c92d4d + 577e893 commit 271db06
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion wasmsdk/blobber.go
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,19 @@ func repairAllocation(allocationID, callbackFuncName string) error {
return err
}
wg.Wait()
return statusBar.err
if statusBar.err != nil {
fmt.Println("Error in repair allocation: ", statusBar.err)
return statusBar.err
}
status, _, err := alloc.CheckAllocStatus()
if err != nil {
return err
}
if status == sdk.Repair || status == sdk.Broken {
fmt.Println("allocation repair failed")
return errors.New("allocation repair failed")
}
return nil
}

// checkAllocStatus check the status of the allocation, either it is ok, needs repair or broken
Expand Down
4 changes: 4 additions & 0 deletions zboxcore/sdk/repairworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func (r *RepairRequest) processRepair(ctx context.Context, a *Allocation) {
SetSingleClietnMode(true)
defer SetSingleClietnMode(false)
}
if shouldSaveProgress {
SetSaveProgress(false)
defer SetSaveProgress(true)
}
r.allocation = a
if a.StorageVersion == StorageV2 {
r.iterateDirV2(ctx)
Expand Down

0 comments on commit 271db06

Please sign in to comment.