mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add periodic cleanup of PG Coordinator state (#8142)
* PG Coordinator cleans orphaned state Signed-off-by: Spike Curtis <spike@coder.com> * Don't need pubsub Signed-off-by: Spike Curtis <spike@coder.com> --------- Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
@@ -3261,6 +3261,17 @@ func (q *sqlQuerier) UpsertServiceBanner(ctx context.Context, value string) erro
|
||||
return err
|
||||
}
|
||||
|
||||
const cleanTailnetCoordinators = `-- name: CleanTailnetCoordinators :exec
|
||||
DELETE
|
||||
FROM tailnet_coordinators
|
||||
WHERE heartbeat_at < now() - INTERVAL '24 HOURS'
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) CleanTailnetCoordinators(ctx context.Context) error {
|
||||
_, err := q.db.ExecContext(ctx, cleanTailnetCoordinators)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteCoordinator = `-- name: DeleteCoordinator :exec
|
||||
DELETE
|
||||
FROM tailnet_coordinators
|
||||
|
||||
Reference in New Issue
Block a user