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:
2026-07-21 11:29:59 +02:00
co-authored by Claude Sonnet 5
parent abb3418669
commit f21ecbd4ee
8 changed files with 51 additions and 7 deletions
+3 -2
View File
@@ -25,8 +25,9 @@ usa i bottoni:
| **Fee address** | L'indirizzo PLM su cui finisce il 30% di ogni round (fee). Obbligatorio: i payout **non partono** se questo campo è vuoto. |
| **Bet amount (PLM)** | Il costo fisso d'ingresso per round, mostrato/impostato in PLM (internamente il backend lavora in sats: 1 PLM = 100.000.000 sats). |
`ROUND_DURATION_SECONDS` (durata del round) **non** è qui: è una variabile
d'ambiente in `.env`, non modificabile a runtime — per cambiarla serve
`ROUND_DURATION_SECONDS` (durata del round) e `ROUND_COOLDOWN_SECONDS` (pausa
tra un round e il successivo, default 30s) **non** sono qui: sono variabili
d'ambiente in `.env`, non modificabili a runtime — per cambiarle serve
riavviare il server con il nuovo valore.
## Alternative all'interfaccia grafica