A match ends, the server crashes halfway, and some players get their rewards twice
At the end of a match many profiles must change, and a failure in the middle leaves some paid and some not. Running the job again then pays the first group twice. Here is a way to make the end of a match safe to repeat.
Why this works
A job that can fail halfway will sooner or later be run again, so being run twice has to be harmless. Putting the note of payment right next to the payment means the two can never disagree, whatever moment the crash hits.
When not to use it
Do not track this for rewards that cannot be double-counted anyway or hardly matter, such as a cosmetic win counter in a casual game. A plain total is enough there. For real money or rare items, use a proper payment record instead.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- A diagram of every state
- 30 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "A match ends, the server crashes halfway, and some players get their rewards twice" (read_entry match-result-paid-exactly-once) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP