MCPcopy
hub / github.com/wavetermdev/waveterm / diagnosticLoop

Function diagnosticLoop

cmd/server/main-server.go:136–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134}
135
136func diagnosticLoop() {
137 defer func() {
138 panichandler.PanicHandler("diagnosticLoop", recover())
139 }()
140 if os.Getenv("WAVETERM_NOPING") != "" {
141 log.Printf("WAVETERM_NOPING set, disabling diagnostic ping\n")
142 return
143 }
144 var lastSentDate string
145 time.Sleep(InitialDiagnosticWait)
146 for {
147 currentDate := time.Now().Format("2006-01-02")
148 if lastSentDate == "" || lastSentDate != currentDate {
149 if sendDiagnosticPing() {
150 lastSentDate = currentDate
151 }
152 }
153 time.Sleep(DiagnosticTick)
154 }
155}
156
157func sendDiagnosticPing() bool {
158 ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)

Callers 1

mainFunction · 0.85

Calls 2

PanicHandlerFunction · 0.92
sendDiagnosticPingFunction · 0.85

Tested by

no test coverage detected