MCPcopy Create free account
hub / github.com/algolia/cli / closeTelemetry

Function closeTelemetry

pkg/cmd/root/root.go:326–340  ·  view source on GitHub ↗

closeTelemetry flushes the pending telemetry events, giving up after a short timeout so an unreachable telemetry endpoint never delays exit.

(ctx context.Context)

Source from the content-addressed store, hash-verified

324// closeTelemetry flushes the pending telemetry events, giving up after a
325// short timeout so an unreachable telemetry endpoint never delays exit.
326func closeTelemetry(ctx context.Context) {
327 client := telemetry.GetTelemetryClient(ctx)
328 if client == nil {
329 return
330 }
331 done := make(chan struct{})
332 go func() {
333 client.Close()
334 close(done)
335 }()
336 select {
337 case <-done:
338 case <-time.After(500 * time.Millisecond):
339 }
340}
341
342// createContext creates a context with telemetry.
343func createContext(

Callers 1

ExecuteFunction · 0.85

Calls 2

GetTelemetryClientFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected