Skip to content

Commit

Permalink
chore: Log errors when processing a download task fails (#14436)
Browse files Browse the repository at this point in the history
At the moment, errors are silently ignored when asynchronous blocks downloading fails.

Signed-off-by: Christian Haudum <[email protected]>
  • Loading branch information
chaudum authored Oct 9, 2024
1 parent 633bb5e commit fdeec61
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/storage/stores/shipper/bloomshipper/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,18 @@ func (f *Fetcher) FetchBlocks(ctx context.Context, refs []BlockRef, opts ...Fetc
}

func (f *Fetcher) processTask(ctx context.Context, task downloadRequest[BlockRef, BlockDirectory]) {
errLogger := log.With(f.logger, "task", task.key, "msg", "failed to process download request")

if ctx.Err() != nil {
level.Error(errLogger).Log("err", ctx.Err())
task.errors <- ctx.Err()
return
}

// check if block was fetched while task was waiting in queue
result, exists, err := f.fromCache(ctx, task.key)
if err != nil {
level.Error(errLogger).Log("err", err)
task.errors <- err
return
}
Expand All @@ -341,6 +345,7 @@ func (f *Fetcher) processTask(ctx context.Context, task downloadRequest[BlockRef
// fetch from storage
result, err = f.fetchBlock(ctx, task.item)
if err != nil {
level.Error(errLogger).Log("err", err)
task.errors <- err
return
}
Expand All @@ -354,6 +359,7 @@ func (f *Fetcher) processTask(ctx context.Context, task downloadRequest[BlockRef
err = f.blocksCache.PutInc(ctx, key, result)
}
if err != nil {
level.Error(errLogger).Log("err", err)
task.errors <- err
return
}
Expand Down

0 comments on commit fdeec61

Please sign in to comment.