mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 13:57:36 -08:00
tsdb: reduce sleep time when reading WAL (#10859)
The code sleeps for a short time to allow goroutines to finish, however it seems the duration can be reduced a lot, speeding up the reading process. I checked using some WAL data from production, and the queue is almost always empty at the time we enter `waitForIdle()` so there is no danger of spinning in the tight loop. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
a84c472745
commit
542b9ecdbd
|
@ -438,7 +438,7 @@ func (wp *walSubsetProcessor) waitUntilIdle() {
|
||||||
}
|
}
|
||||||
wp.input <- []record.RefSample{}
|
wp.input <- []record.RefSample{}
|
||||||
for len(wp.input) != 0 {
|
for len(wp.input) != 0 {
|
||||||
time.Sleep(1 * time.Millisecond)
|
time.Sleep(10 * time.Microsecond)
|
||||||
select {
|
select {
|
||||||
case <-wp.output: // Allow output side to drain to avoid deadlock.
|
case <-wp.output: // Allow output side to drain to avoid deadlock.
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue