(
ctx context.Context, logger slog.Logger,
ps pubsub.Pubsub, store database.Store,
self uuid.UUID, update chan<- hbUpdate,
firstHeartbeat chan<- struct{},
clk quartz.Clock,
)
| 1630 | } |
| 1631 | |
| 1632 | func 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 | |
| 1657 | func (h *heartbeats) filter(mappings []mapping) []mapping { |
| 1658 | out := make([]mapping, 0, len(mappings)) |
no test coverage detected