Skip to content

Commit 9ebca5f

Browse files
fix(relay): tunnel limit counts abandoned reprovisions and frees failed revokes (#26320)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 4e4d4ba commit 9ebca5f

10 files changed

Lines changed: 1931 additions & 67 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- Teardown claims used to bump updated_at past the link's revoke or publish-only write, so a
2+
-- failed deprovision now reads as an unfinished relink. Give those rows the updated_at the
3+
-- current write rule would have left. Touches only withdrawn links' live tunnels; idempotent.
4+
UPDATE "relay_managed_endpoint_allocations" AS a
5+
SET "updated_at" = l."updated_at"
6+
FROM "relay_environment_links" AS l
7+
WHERE l."user_id" = a."user_id"
8+
AND l."environment_id" = a."environment_id"
9+
AND a."tunnel_id" IS NOT NULL
10+
AND a."tunnel_released_at" IS NULL
11+
AND (l."revoked_at" IS NOT NULL OR l."managed_tunnels_enabled" = false)
12+
AND l."updated_at" < a."updated_at";

0 commit comments

Comments
 (0)