snapshot_poker_phase5

This commit is contained in:
DeSqBlocki
2026-09-08 21:49:43 +02:00
parent 6342c4569b
commit 1ef2295c07
9 changed files with 1462 additions and 18 deletions
+36
View File
@@ -8,6 +8,11 @@ const {
PokerEngineError
} = require("./pokerEngine");
const {
recordPokerActionProfile,
recordPokerHandProfiles
} = require("./pokerProfile");
/*
* ============================================================
* CONFIG
@@ -1965,6 +1970,37 @@ function createPokerService({
);
}
/*
* Profile/stat history is secondary to the authoritative
* Poker state. A profile failure must never invalidate a
* successfully committed table action or payout.
*/
try {
await recordPokerActionProfile(
nextGame,
userId,
action
);
if (
nextGame.data.hand
?.state ===
"PAYOUT"
) {
await recordPokerHandProfiles(
nextGame
);
}
}
catch (error) {
console.error(
`[PokerProfile] Failed to persist profile history for ${nextGame.gameId}:`,
error
);
}
return clone(nextGame);
}