fix: bind proposal claims to players

This commit is contained in:
Josh Creek
2026-08-31 22:12:47 +01:00
parent a45d2ddbb7
commit e37a519ef8
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ func CreateProposal(ctx context.Context, db *sql.DB, proposal domain.Proposal, t
if _, err := tx.ExecContext(ctx, ProposalParticipantInsertSQL, proposal.ProposalID, participant.PlayerID, ticketID); err != nil {
return err
}
result, err := tx.ExecContext(ctx, QueueTicketProposeSQL, ticketID, now)
result, err := tx.ExecContext(ctx, QueueTicketProposeSQL, ticketID, participant.PlayerID, now)
if err != nil {
return err
}
+1 -1
View File
@@ -79,5 +79,5 @@ FOR UPDATE SKIP LOCKED`
VALUES ($1, $2, $3, 'PENDING')`
QueueTicketProposeSQL = `UPDATE queue_tickets SET state = 'PROPOSED', revision = revision + 1
WHERE ticket_id = $1 AND state = 'QUEUED' AND expires_at > $2`
WHERE ticket_id = $1 AND player_id = $2 AND state = 'QUEUED' AND expires_at > $3`
)
+1 -1
View File
@@ -19,7 +19,7 @@ func TestRetryableRecognisesPostgresSerializationAndDeadlockErrors(t *testing.T)
}
func TestClaimSQLContainsDurableOwnershipFences(t *testing.T) {
for _, fragment := range []string{"FOR UPDATE SKIP LOCKED", "state = 'QUEUED'", "proposal_participants", "revision = revision + 1", "INSERT INTO proposals", "ranked_season_rollovers", "ON CONFLICT (player_id, season_id) DO NOTHING"} {
for _, fragment := range []string{"FOR UPDATE SKIP LOCKED", "state = 'QUEUED'", "player_id = $2", "proposal_participants", "revision = revision + 1", "INSERT INTO proposals", "ranked_season_rollovers", "ON CONFLICT (player_id, season_id) DO NOTHING"} {
if !containsAnySQL(fragment) {
t.Fatalf("claim boundary missing %q", fragment)
}