mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect/prometheus: fix deadlock in /api/v1/series
on a time range exceeding one day
This commit is contained in:
parent
ac7460abdd
commit
e969346e3e
1 changed files with 1 additions and 3 deletions
|
@ -962,21 +962,19 @@ func SeriesHandler(startTime time.Time, at *auth.Token, w http.ResponseWriter, r
|
||||||
bw := bufferedwriter.Get(w)
|
bw := bufferedwriter.Get(w)
|
||||||
defer bufferedwriter.Put(bw)
|
defer bufferedwriter.Put(bw)
|
||||||
resultsCh := make(chan *quicktemplate.ByteBuffer)
|
resultsCh := make(chan *quicktemplate.ByteBuffer)
|
||||||
doneCh := make(chan struct{})
|
|
||||||
go func() {
|
go func() {
|
||||||
for i := range mns {
|
for i := range mns {
|
||||||
bb := quicktemplate.AcquireByteBuffer()
|
bb := quicktemplate.AcquireByteBuffer()
|
||||||
writemetricNameObject(bb, &mns[i])
|
writemetricNameObject(bb, &mns[i])
|
||||||
resultsCh <- bb
|
resultsCh <- bb
|
||||||
}
|
}
|
||||||
close(doneCh)
|
close(resultsCh)
|
||||||
}()
|
}()
|
||||||
// WriteSeriesResponse must consume all the data from resultsCh.
|
// WriteSeriesResponse must consume all the data from resultsCh.
|
||||||
WriteSeriesResponse(bw, isPartial, resultsCh)
|
WriteSeriesResponse(bw, isPartial, resultsCh)
|
||||||
if err := bw.Flush(); err != nil {
|
if err := bw.Flush(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
<-doneCh
|
|
||||||
seriesDuration.UpdateDuration(startTime)
|
seriesDuration.UpdateDuration(startTime)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue