heartbeatLoop runs in a single goroutine, issuing one batch heartbeat query per interval for all registered chats.
(ctx context.Context)
| 4832 | // heartbeatLoop runs in a single goroutine, issuing one batch |
| 4833 | // heartbeat query per interval for all registered chats. |
| 4834 | func (p *Server) heartbeatLoop(ctx context.Context) { |
| 4835 | ticker := p.clock.NewTicker(p.chatHeartbeatInterval, "chatd", "batch-heartbeat") |
| 4836 | defer ticker.Stop() |
| 4837 | for { |
| 4838 | select { |
| 4839 | case <-ctx.Done(): |
| 4840 | return |
| 4841 | case <-ticker.C: |
| 4842 | p.heartbeatTick(ctx) |
| 4843 | } |
| 4844 | } |
| 4845 | } |
| 4846 | |
| 4847 | // heartbeatTick issues a single batch UPDATE for all running chats |
| 4848 | // owned by this worker. Chats missing from the result set are |
no test coverage detected