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:
Spike Curtis
2023-06-23 13:23:28 +04:00
committed by GitHub
parent c594f02948
commit ba9d038d42
9 changed files with 135 additions and 0 deletions

View File

@ -77,3 +77,8 @@ DO UPDATE SET
id = $1,
heartbeat_at = now() at time zone 'utc'
RETURNING *;
-- name: CleanTailnetCoordinators :exec
DELETE
FROM tailnet_coordinators
WHERE heartbeat_at < now() - INTERVAL '24 HOURS';