feat: 시계 reconciliation 워커와 명령 경계 완성
This commit is contained in:
1 parent
ae7d55ef47
commit
a3e2bf90ae
46 files changed
+3011
-219
No files matched your search
@@ -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)) {
|
||||
|
||||
Reference in new issue
Block a user