Skip to content

Server: expire unanswered rematch offers after 60 seconds#67

Open
testtest126 wants to merge 1 commit into
mainfrom
feature/rematch-offer-expiry
Open

Server: expire unanswered rematch offers after 60 seconds#67
testtest126 wants to merge 1 commit into
mainfrom
feature/rematch-offer-expiry

Conversation

@testtest126

Copy link
Copy Markdown
Owner

Problem

The rematch window only closed on disconnect, explicit decline (#55/#65), queueing elsewhere, or dismissing the sheet. An opponent who stayed connected but simply ignored the offer left the requester on "Waiting for opponent…" indefinitely — the last open item of #39.

Change

  • RematchSlot carries an expiry task scheduled when the slot opens at game end; default window 60s, injectable via GameCoordinator(rematchWindow:) the same way tests already override the clock.
  • On expiry, both players receive rematch_unavailable: the requester stops waiting, and an unanswered offer disappears from the opponent's game-over sheet. The app already handles this message (clears rematchOfferedByOpponent, blocks further requests), so no client changes are needed.
  • Every other slot-teardown path cancels the task.
  • README protocol notes updated.

Tests

testRematchOfferExpires (0.8s window): offer relayed, both sides notified on expiry, late request_rematch rejected with an error, and both players can queue and be paired normally afterwards. Full server suite 26/26 green; the new test passed 3/3 repeat runs.

Closes #39.

🤖 Generated with Claude Code

The rematch slot used to live until a player disconnected, declined,
queued elsewhere, or closed the sheet — an ignored offer left the
requester waiting forever against an idle-but-connected opponent.

Each slot now carries an expiry task (60s, injectable for tests like
the clock override). On expiry both players get rematch_unavailable:
the requester stops waiting and an unanswered offer leaves the
opponent's sheet — the app already handles that message, so no client
changes are needed. Any other slot teardown cancels the task.

Completes the optional-hardening item of #39; the decline action
itself landed in #55/#65.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rematch: add a decline action and offer expiry

1 participant