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

Method filter

enterprise/tailnet/pgcoord.go:1657–1678  ·  view source on GitHub ↗
(mappings []mapping)

Source from the content-addressed store, hash-verified

1655}
1656
1657func (h *heartbeats) filter(mappings []mapping) []mapping {
1658 out := make([]mapping, 0, len(mappings))
1659 h.lock.RLock()
1660 defer h.lock.RUnlock()
1661 for _, m := range mappings {
1662 ok := m.coordinator == h.self
1663 if !ok {
1664 _, ok = h.coordinators[m.coordinator]
1665 if !ok {
1666 // If a mapping exists to a coordinator lost to heartbeats,
1667 // still add the mapping as LOST. If a coordinator misses
1668 // heartbeats but a client is still connected to it, this may be
1669 // the only mapping available for it. Newer mappings will take
1670 // precedence.
1671 m.kind = proto.CoordinateResponse_PeerUpdate_LOST
1672 }
1673 }
1674
1675 out = append(out, m)
1676 }
1677 return out
1678}
1679
1680func (h *heartbeats) subscribe() {
1681 defer h.wg.Done()

Callers 15

NodeMethod · 0.80
bestMappingsMethod · 0.80
ResourcesFunction · 0.80
AgentDevcontainerCardFunction · 0.80
AgentRowFunction · 0.80
PortForwardPopoverViewFunction · 0.80
ResourcesChartFunction · 0.80

Calls

no outgoing calls

Tested by 4

contentLinesFunction · 0.64
hasAccessToAdminSettingsFunction · 0.64
expectLightThemeClassesFunction · 0.64