mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-14 02:10:00 +08:00
chore: performance tunning for stable runner (#4670)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const factor = 10
|
const factor = 10
|
||||||
@@ -100,6 +101,6 @@ func (r *StableRunner[I, O]) Wait() {
|
|||||||
close(r.done)
|
close(r.done)
|
||||||
r.runner.Wait()
|
r.runner.Wait()
|
||||||
for atomic.LoadUint64(&r.consumedIndex) < atomic.LoadUint64(&r.writtenIndex) {
|
for atomic.LoadUint64(&r.consumedIndex) < atomic.LoadUint64(&r.writtenIndex) {
|
||||||
runtime.Gosched()
|
time.Sleep(time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user