Add a cooldown between rounds (ROUND_COOLDOWN_SECONDS)
open_new_round_if_needed now withholds opening the next round until ROUND_COOLDOWN_SECONDS (default 30) have passed since the previous round's closed_at, returning None in that window instead of a Round. Without this, the next round opened within one scheduler tick (~5s) of the previous payout confirming — not enough time for a player to notice the round they were in actually resolved. Callers updated: the scheduler treats None as "nothing to do this tick", and place_bet raises a "try again shortly" BetError instead of crashing on a None round. Not in the original flowchart — a deliberate UX addition on top of it, documented as such in CLAUDE.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,8 @@ class RoundScheduler:
|
||||
async with self._session_factory() as session:
|
||||
round_ = await open_new_round_if_needed(session)
|
||||
await session.commit()
|
||||
if round_ is None:
|
||||
return # still in the cooldown window after the last round closed
|
||||
round_id, status, opened_at = round_.id, round_.status, round_.opened_at
|
||||
|
||||
if status != "open":
|
||||
|
||||
Reference in New Issue
Block a user