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

Method cleanup

enterprise/tailnet/pgcoord.go:1852–1868  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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.
1852func (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}

Callers 1

cleanupLoopMethod · 0.95

Calls 5

IsQueryCanceledErrorFunction · 0.92
CleanTailnetLostPeersMethod · 0.65
CleanTailnetTunnelsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected