cleanup issues a DB command to clean out any old expired coordinators or lost peer state. The cleanup is idempotent, so no need to synchronize with other coordinators.
()
| 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. |
| 1852 | func (h *heartbeats) cleanup() { |
| 1853 | // the records we are attempting to clean up do no serious harm other than |
| 1854 | // accumulating in the tables, so we don't bother retrying if it fails. |
| 1855 | err := h.store.CleanTailnetCoordinators(h.ctx) |
| 1856 | if err != nil && !database.IsQueryCanceledError(err) { |
| 1857 | h.logger.Error(h.ctx, "failed to cleanup old coordinators", slog.Error(err)) |
| 1858 | } |
| 1859 | err = h.store.CleanTailnetLostPeers(h.ctx) |
| 1860 | if err != nil && !database.IsQueryCanceledError(err) { |
| 1861 | h.logger.Error(h.ctx, "failed to cleanup lost peers", slog.Error(err)) |
| 1862 | } |
| 1863 | err = h.store.CleanTailnetTunnels(h.ctx) |
| 1864 | if err != nil && !database.IsQueryCanceledError(err) { |
| 1865 | h.logger.Error(h.ctx, "failed to cleanup abandoned tunnels", slog.Error(err)) |
| 1866 | } |
| 1867 | h.logger.Debug(h.ctx, "completed cleanup") |
| 1868 | } |
no test coverage detected