Skip to content

Commit

Permalink
reverse order of reaping
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Jun 5, 2024
1 parent 0b2d01a commit f1c4976
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions services/horizon/internal/reap/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ func (r *System) clearBefore(ctx context.Context, startSeq, endSeq int32) error
WithField("batch_size", batchSize).
Info("reaper: deleting history outside retention window")

for batchEndSeq := endSeq - 1; batchEndSeq >= startSeq; batchEndSeq -= batchSize {
batchStartSeq := batchEndSeq - batchSize
if batchStartSeq < startSeq {
batchStartSeq = startSeq
for batchStartSeq := startSeq; batchStartSeq < endSeq; batchStartSeq += batchSize {
batchEndSeq := batchStartSeq + batchSize
if batchEndSeq >= endSeq {
batchEndSeq = endSeq - 1
}

if err := r.deleteBatch(ctx, batchStartSeq, batchEndSeq); err != nil {
Expand Down

0 comments on commit f1c4976

Please sign in to comment.