Access chunk time range while holding lock
This commit is contained in:
parent
106eaf39d1
commit
88305e7612
3
head.go
3
head.go
|
@ -756,10 +756,11 @@ func (h *headChunkReader) Chunk(ref uint64) (chunks.Chunk, error) {
|
|||
|
||||
s.Lock()
|
||||
c := s.chunk(int(cid))
|
||||
mint, maxt := c.minTime, c.maxTime
|
||||
s.Unlock()
|
||||
|
||||
// Do not expose chunks that are outside of the specified range.
|
||||
if c == nil || !intervalOverlap(c.minTime, c.maxTime, h.mint, h.maxt) {
|
||||
if c == nil || !intervalOverlap(mint, maxt, h.mint, h.maxt) {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
return &safeChunk{
|
||||
|
|
Loading…
Reference in New Issue