mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
lib/logstorage: skip scheduled work when stopCh is closed
This saves CPU time
This commit is contained in:
parent
e42b9d26a9
commit
ffdafc32c6
1 changed files with 7 additions and 0 deletions
|
@ -133,6 +133,13 @@ func (s *Storage) search(workersCount int, so *genericSearchOptions, stopCh <-ch
|
|||
bs := getBlockSearch()
|
||||
for bsws := range workCh {
|
||||
for _, bsw := range bsws {
|
||||
select {
|
||||
case <-stopCh:
|
||||
// The search has been canceled. Just skip all the scheduled work in order to save CPU time.
|
||||
continue
|
||||
default:
|
||||
}
|
||||
|
||||
bs.search(bsw)
|
||||
if bs.br.RowsCount() > 0 {
|
||||
processBlockResult(workerID, &bs.br)
|
||||
|
|
Loading…
Reference in a new issue