vmselect/netstorage: remove direct calls to Gosched to reduce amount of locks for global scope

using `runtime.Gosched` requires acquiring global lock to check if there are any other goroutines to perform tasks. with the latest versions of runtime it can pause running goroutines automatically without requiring to call `Gosched` directly.

Updates #3966

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
This commit is contained in:
Zakhar Bessarab 2023-03-24 16:15:13 +03:00 committed by Aliaksandr Valialkin
parent 811f4a9380
commit 28f054bb00
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -152,8 +152,6 @@ func timeseriesWorker(qt *querytracer.Tracer, workChs []chan *timeseriesWork, wo
idx := (i + workerID) % uint(len(workChs)) idx := (i + workerID) % uint(len(workChs))
ch := workChs[idx] ch := workChs[idx]
for len(ch) > 0 { for len(ch) > 0 {
// Give a chance other goroutines to perform their work.
runtime.Gosched()
// It is expected that every channel in the workChs is already closed, // It is expected that every channel in the workChs is already closed,
// so the next line should return immediately. // so the next line should return immediately.
tsw, ok := <-ch tsw, ok := <-ch