Skip to content

Commit

Permalink
Retry on any delete error
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Dec 8, 2023
1 parent 0dafa38 commit 274bbeb
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions ipni-gc/reaper/reaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,12 +652,9 @@ func (s *scythe) removeEntriesWithCar(ctx context.Context, adCid cid.Cid) (int,
}
if commit {
if err = indexer.Remove(value, chunk.Entries...); err != nil {
if errors.Is(err, context.DeadlineExceeded) {
log.Errorw("Timed out removing indexes from valuestore, retrying", "indexes", len(chunk.Entries))
time.Sleep(100 * time.Millisecond)
err = indexer.Remove(value, chunk.Entries...)
}
if err != nil {
log.Errorw("Failed to remove indexes from valuestore, retrying", "err", err, "indexes", len(chunk.Entries))
time.Sleep(100 * time.Millisecond)
if err = indexer.Remove(value, chunk.Entries...); err != nil {
return mhCount, fmt.Errorf("%w: %w", errIndexerWrite, err)
}
}
Expand Down Expand Up @@ -703,12 +700,9 @@ func (s *scythe) removeEntriesWithPublisher(ctx context.Context, adCid cid.Cid)
}
if commit {
if err = indexer.Remove(value, chunk.Entries...); err != nil {
if errors.Is(err, context.DeadlineExceeded) {
log.Errorw("Timed out removing indexes from valuestore, retrying", "indexes", len(chunk.Entries))
time.Sleep(100 * time.Millisecond)
err = indexer.Remove(value, chunk.Entries...)
}
if err != nil {
log.Errorw("Failed to remove indexes from valuestore, retrying", "err", err, "indexes", len(chunk.Entries))
time.Sleep(100 * time.Millisecond)
if err = indexer.Remove(value, chunk.Entries...); err != nil {
return mhCount, fmt.Errorf("%w: %w", errIndexerWrite, err)
}
}
Expand Down

0 comments on commit 274bbeb

Please sign in to comment.