chore: performance tunning for stable runner (#4670)

This commit is contained in:
Kevin Wan
2025-02-26 19:19:24 +08:00
committed by GitHub
parent 327ef73700
commit 3315e60272

View File

@@ -5,6 +5,7 @@ import (
"runtime"
"sync"
"sync/atomic"
"time"
)
const factor = 10
@@ -100,6 +101,6 @@ func (r *StableRunner[I, O]) Wait() {
close(r.done)
r.runner.Wait()
for atomic.LoadUint64(&r.consumedIndex) < atomic.LoadUint64(&r.writtenIndex) {
runtime.Gosched()
time.Sleep(time.Millisecond)
}
}