MCPcopy Index your code
hub / github.com/coder/coder / registerHeartbeat

Method registerHeartbeat

coderd/x/chatd/chatd.go:4812–4822  ·  view source on GitHub ↗

registerHeartbeat enrolls a chat in the centralized batch heartbeat loop. Must be called after chatCtx is created.

(entry *heartbeatEntry)

Source from the content-addressed store, hash-verified

4810// registerHeartbeat enrolls a chat in the centralized batch
4811// heartbeat loop. Must be called after chatCtx is created.
4812func (p *Server) registerHeartbeat(entry *heartbeatEntry) {
4813 p.heartbeatMu.Lock()
4814 defer p.heartbeatMu.Unlock()
4815 if _, exists := p.heartbeatRegistry[entry.chatID]; exists {
4816 p.logger.Warn(context.Background(),
4817 "duplicate heartbeat registration, skipping",
4818 slog.F("chat_id", entry.chatID))
4819 return
4820 }
4821 p.heartbeatRegistry[entry.chatID] = entry
4822}
4823
4824// unregisterHeartbeat removes a chat from the centralized
4825// heartbeat loop when chat processing finishes.

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45