MCPcopy Create free account
hub / github.com/coder/coder / Run

Method Run

enterprise/coderd/proxyhealth/proxyhealth.go:129–146  ·  view source on GitHub ↗

Run will block until the context is canceled. It will periodically check the health of all proxies and store the results in the cache.

(ctx context.Context)

Source from the content-addressed store, hash-verified

127// Run will block until the context is canceled. It will periodically check the
128// health of all proxies and store the results in the cache.
129func (p *ProxyHealth) Run(ctx context.Context) {
130 ticker := time.NewTicker(p.interval)
131 defer ticker.Stop()
132
133 for {
134 select {
135 case <-ctx.Done():
136 return
137 case now := <-ticker.C:
138 statuses, err := p.runOnce(ctx, now)
139 if err != nil {
140 p.logger.Error(ctx, "proxy health check failed", slog.Error(err))
141 continue
142 }
143 p.storeProxyHealth(statuses)
144 }
145 }
146}
147
148func (p *ProxyHealth) storeProxyHealth(statuses map[uuid.UUID]ProxyStatus) {
149 var proxyHosts []*agplproxyhealth.ProxyHost

Callers

nothing calls this directly

Calls 5

runOnceMethod · 0.95
storeProxyHealthMethod · 0.95
StopMethod · 0.65
DoneMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected