()
| 12 | const NotifyMaxDebounceTime = 2 * time.Millisecond |
| 13 | |
| 14 | func (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 | |
| 33 | func (c *ClientImpl) asyncInitiationLoop() { |
| 34 | var ( |
no test coverage detected