fix(clock): preserve UTC leases and unification recovery

This commit is contained in:
Hide_D committed 2026-09-03 19:40:14 +00:00
1 parent 62006fb2d4
commit a2b0b997a2
9 files changed
+351 -21

No files matched your search

@@ -0,0 +1,20 @@
-- A daemon lease is an operational WALL_TIME deadline. The game database keeps
-- legacy DateTime columns as TIMESTAMP(3), while its session timezone can be
-- Asia/Seoul, so bare CURRENT_TIMESTAMP writes were nine hours ahead of the UTC
-- comparisons used by clock fencing.
--
-- Lease rows are ephemeral authority, not business history. Expire every row at
-- the migration boundary so an old writer is fenced and a new UTC-aware daemon
-- must acquire a fresh epoch. This also makes mixed-version deployment fail
-- closed instead of preserving a falsely-live lease.
BEGIN;
UPDATE "turn_daemon_lease"
SET
"lease_until" = CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
"heartbeat_at" = CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
ALTER TABLE "turn_daemon_lease"
ALTER COLUMN "heartbeat_at" SET DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC');
COMMIT;