()
| 1837 | } |
| 1838 | |
| 1839 | func (h *heartbeats) cleanupLoop() { |
| 1840 | defer h.wg.Done() |
| 1841 | h.cleanup() |
| 1842 | tkr := h.clock.TickerFunc(h.ctx, cleanupPeriod, func() error { |
| 1843 | h.cleanup() |
| 1844 | return nil |
| 1845 | }, "heartbeats", "cleanupLoop") |
| 1846 | err := tkr.Wait() |
| 1847 | h.logger.Debug(h.ctx, "ending cleanupLoop", slog.Error(err)) |
| 1848 | } |
| 1849 | |
| 1850 | // cleanup issues a DB command to clean out any old expired coordinators or lost peer state. The |
| 1851 | // cleanup is idempotent, so no need to synchronize with other coordinators. |