Skip to content

Commit

Permalink
batch sector remove
Browse files Browse the repository at this point in the history
  • Loading branch information
LexLuthr authored and ribasushi committed Aug 20, 2024
1 parent 03ed205 commit aa34789
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/lotus-miner/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,13 +1209,21 @@ var sectorsExpiredCmd = &cli.Command{
return xerrors.Errorf("value of confirm-remove-count doesn't match the number of sectors which can be removed (%d)", len(toRemove))
}

batchSizeReached := 0

for _, number := range toRemove {
fmt.Printf("Removing sector\t%s:\t", color.YellowString("%d", number))
if batchSizeReached == 5 {
fmt.Printf("Waiting for 2 seconds before starting next batch of 5 sectors")
batchSizeReached = 0
time.Sleep(2 * time.Second)
}

err := minerAPI.SectorRemove(ctx, number)
if err != nil {
color.Red("ERROR: %s\n", err.Error())
} else {
batchSizeReached++
color.Green("OK\n")
}
}
Expand Down

0 comments on commit aa34789

Please sign in to comment.