fix(multiplayer): advance tickets on allocation bind

This commit is contained in:
Josh Creek
2026-09-01 10:42:10 +01:00
parent 25fdc2c2c8
commit 013eb0778b
5 changed files with 41 additions and 24 deletions
+4 -4
View File
@@ -9,10 +9,10 @@ import (
func TestAllocationMatchClaimSQLFencesConcurrentWorkers(t *testing.T) {
checks := map[string][]string{
ClaimAllocatingMatchSQL: {"FOR UPDATE SKIP LOCKED", "allocation_id = 'allocation-' || candidate.match_id", "allocation_claimed_at <= $1", "ORDER BY created_at, match_id"},
AllocatingMatchBuildSQL: {"match_participants", "queue_tickets", "ORDER BY q.client_build"},
BindAllocatedMatchSQL: {"allocation_id = $2", "server_id IS NULL", "SET server_id = $3", "FROM allocations"},
ReleaseAllocatedMatchClaimSQL: {"allocation_id = $2", "allocation_id = NULL", "allocation_claimed_at = NULL"},
ClaimAllocatingMatchSQL: {"FOR UPDATE SKIP LOCKED", "allocation_id = 'allocation-' || candidate.match_id", "allocation_claimed_at <= $1", "ORDER BY created_at, match_id"},
AllocatingMatchBuildSQL: {"match_participants", "queue_tickets", "ORDER BY q.client_build"},
BindAllocatedMatchParticipantsSQL: {"allocation_id = $2", "server_id IS NULL", "SET server_id = $3", "FROM allocations", "state = 'ALLOCATING'", "revision = revision + 1"},
ReleaseAllocatedMatchClaimSQL: {"allocation_id = $2", "allocation_id = NULL", "allocation_claimed_at = NULL"},
}
for query, fragments := range checks {
for _, fragment := range fragments {