MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / sendHeartbeat

Function sendHeartbeat

cmd/server.go:140–156  ·  view source on GitHub ↗

sendHeartbeat initializes and maintains a periodic heartbeat to PostHog

(client posthog.Client, heartbeatID string)

Source from the content-addressed store, hash-verified

138
139// sendHeartbeat initializes and maintains a periodic heartbeat to PostHog
140func sendHeartbeat(client posthog.Client, heartbeatID string) {
141 ticker := time.NewTicker(5 * time.Minute)
142 go func() {
143 for range ticker.C {
144 if err := client.Enqueue(posthog.Capture{
145 DistinctId: heartbeatID,
146 Event: "server_heartbeat",
147 Timestamp: time.Now().UTC(),
148 Properties: map[string]interface{}{
149 "timestamp": time.Now().UTC(),
150 },
151 }); err != nil {
152 logrus.Errorf("Failed to send heartbeat: %v", err)
153 }
154 }
155 }()
156}
157
158func healthCheckHandler(c *gin.Context) {
159 cfg, err := config.Fetch()

Callers 1

initializePostHogFunction · 0.85

Calls 1

EnqueueMethod · 0.80

Tested by

no test coverage detected