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

Function newHeartbeats

enterprise/tailnet/pgcoord.go:1632–1655  ·  view source on GitHub ↗
(
	ctx context.Context, logger slog.Logger,
	ps pubsub.Pubsub, store database.Store,
	self uuid.UUID, update chan<- hbUpdate,
	firstHeartbeat chan<- struct{},
	clk quartz.Clock,
)

Source from the content-addressed store, hash-verified

1630}
1631
1632func newHeartbeats(
1633 ctx context.Context, logger slog.Logger,
1634 ps pubsub.Pubsub, store database.Store,
1635 self uuid.UUID, update chan<- hbUpdate,
1636 firstHeartbeat chan<- struct{},
1637 clk quartz.Clock,
1638) *heartbeats {
1639 h := &heartbeats{
1640 ctx: ctx,
1641 logger: logger,
1642 pubsub: ps,
1643 store: store,
1644 self: self,
1645 update: update,
1646 firstHeartbeat: firstHeartbeat,
1647 coordinators: make(map[uuid.UUID]time.Time),
1648 clock: clk,
1649 }
1650 h.wg.Add(3)
1651 h.subscribe()
1652 go h.sendBeats()
1653 go h.cleanupLoop()
1654 return h
1655}
1656
1657func (h *heartbeats) filter(mappings []mapping) []mapping {
1658 out := make([]mapping, 0, len(mappings))

Callers 1

newQuerierFunction · 0.85

Calls 4

subscribeMethod · 0.95
sendBeatsMethod · 0.95
cleanupLoopMethod · 0.95
AddMethod · 0.65

Tested by

no test coverage detected