From 274bbeb80d6efcfa0af41712f368f6417e04c4d7 Mon Sep 17 00:00:00 2001 From: gammazero Date: Fri, 8 Dec 2023 01:11:41 -0800 Subject: [PATCH] Retry on any delete error --- ipni-gc/reaper/reaper.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ipni-gc/reaper/reaper.go b/ipni-gc/reaper/reaper.go index a55ea3439..66c17d438 100644 --- a/ipni-gc/reaper/reaper.go +++ b/ipni-gc/reaper/reaper.go @@ -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) } } @@ -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) } }