mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
4627dd58fb
The timeout sibling of the previous commit's decline fix: a proposal that simply times out (the 10s window elapses with no unanimous response) hits ProposalExpireSQL/ProposalParticipantExpireSQL, and neither of those -- same as the decline path -- ever touched queue_tickets. Same severe consequence: every participant still holding a PROPOSED ticket, response pending or already accepted, is left stranded (invisible to the matcher, blocking a fresh queue_create, renewable forever by heartbeat) with no automatic way back into matchmaking. This path is reached from both GetProposal (the recovery/read boundary -- a client that missed the expiry event entirely) and RespondToProposal (a response arriving after the window), so both needed the fix. ProposalExpireRequeueSQL mirrors ProposalDeclineRequeueSQL, guarded on state = 'EXPIRED' so it's safe to call unconditionally right after ProposalExpireSQL: a no-op on a proposal that's still OPEN, and a no-op on a proposal that was already EXPIRED on a prior pass (nothing left at PROPOSED to requeue a second time). Covered by a real PostgreSQL integration test via GetProposal (nobody ever responds; recovering the proposal well after its window expires it and must requeue both participants), confirming both tickets land back at QUEUED with a refreshed expiry and are visible again to ListQueuedCandidates. Clean across 5 runs, plus the full integration and unit suites.