Merge pull request #14103 from krajorama/handle-context-cancel-in-postingsformatcher

tsdb/index/postings: fix missing lock unlock
This commit is contained in:
Björn Rabenstein 2024-05-15 14:37:12 +02:00 committed by GitHub
commit 179163a4c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -419,6 +419,7 @@ func (p *MemPostings) PostingsForLabelMatching(ctx context.Context, name string,
count := 1 count := 1
for _, v := range vals { for _, v := range vals {
if count%checkContextEveryNIterations == 0 && ctx.Err() != nil { if count%checkContextEveryNIterations == 0 && ctx.Err() != nil {
p.mtx.RUnlock()
return ErrPostings(ctx.Err()) return ErrPostings(ctx.Err())
} }
count++ count++