From a6af6c54ba62d1c02545604c23184b8153db7dc7 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Tue, 6 May 2025 14:52:15 -0400 Subject: [PATCH] Avoid inclusive end bound until last possible moment Inclusive end bounds are the devil. --- monitor/monitor.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor/monitor.go b/monitor/monitor.go index bbb6e3e..8b8cbd4 100644 --- a/monitor/monitor.go +++ b/monitor/monitor.go @@ -83,10 +83,10 @@ func withRetry(ctx context.Context, maxRetries int, f func() error) error { return ctx.Err() } -func getEntriesFull(ctx context.Context, client ctclient.Log, startInclusive, endInclusive uint64) ([]ctclient.Entry, error) { - allEntries := make([]ctclient.Entry, 0, endInclusive-startInclusive+1) - for startInclusive <= endInclusive { - entries, err := client.GetEntries(ctx, startInclusive, endInclusive) +func getEntriesFull(ctx context.Context, client ctclient.Log, startInclusive, endExclusive uint64) ([]ctclient.Entry, error) { + allEntries := make([]ctclient.Entry, 0, endExclusive-startInclusive) + for startInclusive < endExclusive { + entries, err := client.GetEntries(ctx, startInclusive, endExclusive-1) if err != nil { return nil, err } @@ -418,7 +418,7 @@ func downloadWorker(ctx context.Context, config *Config, ctlog *loglist.Log, cli case batch = <-batchesIn: } - entries, err := getEntriesFull(ctx, client, batch.begin, batch.end-1) + entries, err := getEntriesFull(ctx, client, batch.begin, batch.end) if err != nil { return err }