fix(games): reject duplicate queue entries (#117)
Some checks are pending
CI / build (push) Waiting to run
deploy / deploy (push) Waiting to run
test / test (push) Waiting to run

* test(games): reproduce duplicate queue deadlock

* fix(games): reject duplicate queue entries
This commit is contained in:
RissRIce 2026-08-12 22:20:18 -06:00 • committed by GitHub
parent be75744248
commit 5a1f5d90db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 56 additions and 2 deletions

View file

@ -70,6 +70,9 @@ func (a *app) handleGame(s ssh.Session) {
case errors.Is(err, games.ErrNoOpponent):
_ = conn.Send(errEnvelope("no opponent found — try again later"))
_ = s.Exit(1)
case errors.Is(err, games.ErrAlreadyQueued):
_ = conn.Send(errEnvelope("this account is already queued for that game"))
_ = s.Exit(1)
case err != nil && !errors.Is(err, games.ErrUnknownGame):
// Unknown-game is already handled above; anything else is a wait abort
// (e.g. the agent disconnected) and needs no message.