fix(multiplayer): recover assignment handoff

This commit is contained in:
Josh Creek
2026-09-02 18:47:00 +01:00
parent 84d27d82da
commit 91658fbc13
12 changed files with 147 additions and 15 deletions
@@ -306,6 +306,10 @@ func TestPostgreSQLAllocationMatchClaimLeaseAndBindFence(t *testing.T) {
if err := BindAllocatedMatch(ctx, db, allocation); err != nil {
t.Fatalf("bind allocation: %v", err)
}
recoveredTicket, err := GetQueueTicket(ctx, db, "allocation-match-a", "allocation-match-ticket-0", now.Add(2*time.Second))
if err != nil || recoveredTicket.MatchID != "allocation-match" {
t.Fatalf("recovered ticket match=%q err=%v", recoveredTicket.MatchID, err)
}
var allocatingTickets int
if err := db.QueryRowContext(ctx, `SELECT count(*) FROM queue_tickets WHERE ticket_id LIKE 'allocation-match-ticket-%' AND state = 'ALLOCATING'`).Scan(&allocatingTickets); err != nil || allocatingTickets != 2 {
t.Fatalf("allocating tickets=%d err=%v", allocatingTickets, err)