commit 43dae81b779cc0f9725928713e656eb3cd4003a1
parent 1454628b8a843956e2b553ad43f1a3346f4337af
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 7 Dec 2023 23:31:24 -0500
improve logs
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -605,6 +605,7 @@ func dealerThread(db *database.DkfDB, g *PokerGame, roomID string) {
deckHash := utils.MD5([]byte(strings.Join(g.Ongoing.Deck, "")))
PokerPubSub.Pub(roomTopic, GameStartedEvent{DeckHash: deckHash})
+ newLogEvent(g, roomLogsTopic, fmt.Sprintf("New game, deck hash: %s", deckHash))
p := g.Ongoing.Players[g.smallBlindIdx]
bet := SmallBlindBet
@@ -779,7 +780,9 @@ END:
g.PlayersMtx.RUnlock()
g.IsGameDone.Store(true)
- PokerPubSub.Pub(roomTopic, GameIsDoneEvent{DeckStr: strings.Join(g.Ongoing.Deck, ""), Winner: winnersStr, WinnerHand: winnerHand})
+ deckStr := strings.Join(g.Ongoing.Deck, "")
+ PokerPubSub.Pub(roomTopic, GameIsDoneEvent{DeckStr: deckStr, Winner: winnersStr, WinnerHand: winnerHand})
+ newLogEvent(g, roomLogsTopic, fmt.Sprintf("Game ended, deck: %s", deckStr))
// Wait a minimum of X seconds before allowing a new game
time.Sleep(MinTimeAfterGame * time.Second)