fix: VM 시간 변경 후 턴 lease를 안전하게 자동 복구
This commit is contained in:
1 parent
7dc1670935
commit
4fb1343943
11 files changed
+224
-45
No files matched your search
@@ -184,6 +184,7 @@ export class DatabaseTurnDaemonLease {
|
||||
if (!token || this.lost) {
|
||||
throw this.getLossError();
|
||||
}
|
||||
// CURRENT_TIMESTAMP는 transaction 시작에 고정되어 VM 정지 중 만료를 놓친다.
|
||||
const db = transaction ?? this.db;
|
||||
const rows = await db.$queryRaw<LeaseRow[]>(GamePrisma.sql`
|
||||
SELECT "profile", "owner_id", "fencing_epoch"
|
||||
@@ -192,7 +193,7 @@ export class DatabaseTurnDaemonLease {
|
||||
"profile" = ${token.profile}
|
||||
AND "owner_id" = ${token.ownerId}
|
||||
AND "fencing_epoch" = ${token.fencingEpoch}
|
||||
AND "lease_until" > CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
|
||||
AND "lease_until" > clock_timestamp() AT TIME ZONE 'UTC'
|
||||
FOR UPDATE
|
||||
`);
|
||||
if (rows.length === 0) {
|
||||
|
||||
Reference in new issue
Block a user