MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / notifyAsyncRenderWork

Method notifyAsyncRenderWork

tsunami/engine/asyncnotify.go:14–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12const NotifyMaxDebounceTime = 2 * time.Millisecond
13
14func (c *ClientImpl) notifyAsyncRenderWork() {
15 c.notifyOnce.Do(func() {
16 c.notifyWakeCh = make(chan struct{}, 1)
17 go c.asyncInitiationLoop()
18 })
19
20 nowNs := time.Now().UnixNano()
21 c.notifyLastEventNs.Store(nowNs)
22 // Establish batch start if there's no active batch.
23 if c.notifyBatchStartNs.Load() == 0 {
24 c.notifyBatchStartNs.CompareAndSwap(0, nowNs)
25 }
26 // Coalesced wake-up.
27 select {
28 case c.notifyWakeCh <- struct{}{}:
29 default:
30 }
31}
32
33func (c *ClientImpl) asyncInitiationLoop() {
34 var (

Callers 1

addRenderWorkMethod · 0.80

Calls 1

asyncInitiationLoopMethod · 0.95

Tested by

no test coverage detected