feat: 시계 reconciliation 워커와 명령 경계 완성

This commit is contained in:
Hide_D committed 2026-09-03 09:40:48 +00:00
1 parent ae7d55ef47
commit a3e2bf90ae
46 files changed
+3011 -219

No files matched your search

+15 -8
View File
@@ -1,4 +1,4 @@
import type { GamePrisma, GamePrismaClient } from '@sammo-ts/infra';
import { readInputEventClockCoordinate, type GamePrisma, type GamePrismaClient } from '@sammo-ts/infra';
import { randomUUID } from 'node:crypto';
import {
@@ -137,13 +137,20 @@ const ensureEngineCommand = async (
deltaMinutes,
};
try {
await db.inputEvent.create({
data: {
requestId,
target: 'ENGINE',
eventType: command.type,
payload: asJson(command),
},
await db.$transaction(async (transaction) => {
const coordinate = await readInputEventClockCoordinate(transaction);
await transaction.inputEvent.create({
data: {
requestId,
target: 'ENGINE',
eventType: command.type,
payload: asJson(command),
acceptedGameTick: coordinate.gameTick,
acceptedClockRevision: coordinate.clockRevision,
acceptedDeadlineGeneration: coordinate.deadlineGeneration,
createdAt: coordinate.wallAt,
},
});
});
} catch (error) {
if (!isUniqueConflict(error)) {