Avoid inclusive end bound until last possible moment
Inclusive end bounds are the devil.
This commit is contained in:
parent
8119925c16
commit
a6af6c54ba
|
@ -83,10 +83,10 @@ func withRetry(ctx context.Context, maxRetries int, f func() error) error {
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
func getEntriesFull(ctx context.Context, client ctclient.Log, startInclusive, endInclusive uint64) ([]ctclient.Entry, error) {
|
func getEntriesFull(ctx context.Context, client ctclient.Log, startInclusive, endExclusive uint64) ([]ctclient.Entry, error) {
|
||||||
allEntries := make([]ctclient.Entry, 0, endInclusive-startInclusive+1)
|
allEntries := make([]ctclient.Entry, 0, endExclusive-startInclusive)
|
||||||
for startInclusive <= endInclusive {
|
for startInclusive < endExclusive {
|
||||||
entries, err := client.GetEntries(ctx, startInclusive, endInclusive)
|
entries, err := client.GetEntries(ctx, startInclusive, endExclusive-1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ func downloadWorker(ctx context.Context, config *Config, ctlog *loglist.Log, cli
|
||||||
case batch = <-batchesIn:
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue