fix reserved turn queue concurrency
This commit is contained in:
@@ -338,12 +338,20 @@ describe('integration initialization flow', () => {
|
||||
for (const [idx, user] of userSessions.entries()) {
|
||||
const accessRef = { value: user.accessToken };
|
||||
const userGameClient = createGameClient(gameUrl, gameServer.config.trpcPath, accessRef);
|
||||
if (idx < 3) {
|
||||
await userGameClient.turns.reserved.setGeneral.mutate({
|
||||
let queueRevision = (
|
||||
await userGameClient.turns.reserved.getGeneral.query({
|
||||
generalId: user.generalId,
|
||||
turnIndex: 0,
|
||||
action: 'che_거병',
|
||||
});
|
||||
})
|
||||
).revision;
|
||||
if (idx < 3) {
|
||||
queueRevision = (
|
||||
await userGameClient.turns.reserved.setGeneral.mutate({
|
||||
generalId: user.generalId,
|
||||
turnIndex: 0,
|
||||
action: 'che_거병',
|
||||
expectedRevision: queueRevision,
|
||||
})
|
||||
).revision;
|
||||
await userGameClient.turns.reserved.setGeneral.mutate({
|
||||
generalId: user.generalId,
|
||||
turnIndex: 1,
|
||||
@@ -353,20 +361,25 @@ describe('integration initialization flow', () => {
|
||||
nationType: 'che_def',
|
||||
colorType: idx,
|
||||
},
|
||||
expectedRevision: queueRevision,
|
||||
});
|
||||
} else {
|
||||
const destNationId = joinNationIds[(idx - 3) % joinNationIds.length]!;
|
||||
await userGameClient.turns.reserved.setGeneral.mutate({
|
||||
generalId: user.generalId,
|
||||
turnIndex: 0,
|
||||
action: 'che_임관',
|
||||
args: { destNationId },
|
||||
});
|
||||
queueRevision = (
|
||||
await userGameClient.turns.reserved.setGeneral.mutate({
|
||||
generalId: user.generalId,
|
||||
turnIndex: 0,
|
||||
action: 'che_임관',
|
||||
args: { destNationId },
|
||||
expectedRevision: queueRevision,
|
||||
})
|
||||
).revision;
|
||||
await userGameClient.turns.reserved.setGeneral.mutate({
|
||||
generalId: user.generalId,
|
||||
turnIndex: 1,
|
||||
action: 'che_임관',
|
||||
args: { destNationId },
|
||||
expectedRevision: queueRevision,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,10 +99,11 @@ export INPUT_EVENT_DATABASE_URL=$database_url
|
||||
export GENERAL_LIFECYCLE_DATABASE_URL=$database_url
|
||||
export TURN_DAEMON_LEASE_DATABASE_URL=$database_url
|
||||
export TURN_DIFFERENTIAL_DATABASE_URL=$database_url
|
||||
export RESERVED_TURN_DATABASE_URL=$database_url
|
||||
|
||||
pnpm --filter @sammo-ts/infra prisma:db:push:game
|
||||
|
||||
database_markers='INPUT_EVENT_DATABASE_URL|GENERAL_LIFECYCLE_DATABASE_URL|TURN_DAEMON_LEASE_DATABASE_URL'
|
||||
database_markers='INPUT_EVENT_DATABASE_URL|GENERAL_LIFECYCLE_DATABASE_URL|TURN_DAEMON_LEASE_DATABASE_URL|RESERVED_TURN_DATABASE_URL'
|
||||
run_marked_tests app/game-api "$database_markers" "PostgreSQL"
|
||||
run_marked_tests app/game-engine "$database_markers" "PostgreSQL"
|
||||
run_marked_tests tools/integration-tests \
|
||||
|
||||
Reference in New Issue
Block a user