Skip to content

Commit 8aa350a

Browse files
committed
Catch context error when getting bucket index
Signed-off-by: Wilbert Guo <[email protected]>
1 parent 77c7138 commit 8aa350a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/storage/tsdb/bucketindex/loader.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ func NewLoader(cfg LoaderConfig, bucketClient objstore.Bucket, cfgProvider bucke
9292
// GetIndex returns the bucket index for the given user. It returns the in-memory cached
9393
// index if available, or load it from the bucket otherwise.
9494
func (l *Loader) GetIndex(ctx context.Context, userID string) (*Index, Status, error) {
95+
if ctx.Err() != nil {
96+
level.Warn(l.logger).Log("msg", "received context error when attempting to load bucket index", "err", ctx.Err())
97+
return nil, UnknownStatus, ctx.Err()
98+
}
99+
95100
l.indexesMx.RLock()
96101
if entry := l.indexes[userID]; entry != nil {
97102
idx := entry.index

0 commit comments

Comments
 (0)