Try to avoid race condition by transaction.
Use weaker transaction
Close connection on unhandled exception.
Optimize write without transactions.
Move RPC out of end_game's transaction.
Send only once per transaction.