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

Method sendBeat

enterprise/tailnet/pgcoord.go:1817–1837  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1815}
1816
1817func (h *heartbeats) sendBeat() {
1818 _, err := h.store.UpsertTailnetCoordinator(h.ctx, h.self)
1819 if database.IsQueryCanceledError(err) {
1820 return
1821 }
1822 if err != nil {
1823 h.logger.Error(h.ctx, "failed to send heartbeat", slog.Error(err))
1824 h.failedHeartbeats++
1825 if h.failedHeartbeats == 3 {
1826 h.logger.Error(h.ctx, "coordinator failed 3 heartbeats and is unhealthy")
1827 _ = agpl.SendCtx(h.ctx, h.update, hbUpdate{health: healthUpdateUnhealthy})
1828 }
1829 return
1830 }
1831 publishCoordinatorHeartbeat(h.ctx, h.pubsub, h.logger, h.self)
1832 if h.failedHeartbeats >= 3 {
1833 h.logger.Info(h.ctx, "coordinator sent heartbeat and is healthy")
1834 _ = agpl.SendCtx(h.ctx, h.update, hbUpdate{health: healthUpdateHealthy})
1835 }
1836 h.failedHeartbeats = 0
1837}
1838
1839func (h *heartbeats) cleanupLoop() {
1840 defer h.wg.Done()

Callers 1

sendBeatsMethod · 0.95

Calls 5

IsQueryCanceledErrorFunction · 0.92
ErrorMethod · 0.45
InfoMethod · 0.45

Tested by

no test coverage detected