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

Method pollDERP

coderd/tailnet.go:625–648  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

623}
624
625func (a *pollingDERPClient) pollDERP() {
626 defer close(a.loopDone)
627 defer a.logger.Debug(a.ctx, "polling DERPMap exited")
628
629 ticker := time.NewTicker(5 * time.Second)
630 defer ticker.Stop()
631
632 for {
633 select {
634 case <-a.ctx.Done():
635 return
636 case <-ticker.C:
637 }
638
639 newDerpMap := a.fn()
640 if !tailnet.CompareDERPMaps(a.lastDERPMap, newDerpMap) {
641 select {
642 case <-a.ctx.Done():
643 return
644 case a.ch <- newDerpMap:
645 }
646 }
647 }
648}
649
650type closeAll struct {
651 coord tailnet.CoordinatorClient

Callers 1

newPollingDERPClientFunction · 0.95

Calls 3

CompareDERPMapsFunction · 0.92
StopMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected