mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
feat: validate queue compatibility metadata
This commit is contained in:
@@ -26,6 +26,7 @@ type QueueTicket struct {
|
||||
TicketID string
|
||||
PlayerID string
|
||||
Candidate Candidate
|
||||
Playlist Playlist
|
||||
State State
|
||||
Revision uint64
|
||||
EnqueuedAt time.Time
|
||||
@@ -70,7 +71,7 @@ func (q *Queue) Create(playerID, ticketID, idempotencyKey string, candidate Cand
|
||||
if _, ok := q.tickets[ticketID]; ok {
|
||||
return QueueTicket{}, fmt.Errorf("%w: ticket ID already exists", ErrConflict)
|
||||
}
|
||||
ticket := QueueTicket{TicketID: ticketID, PlayerID: playerID, Candidate: candidate, State: Queued, EnqueuedAt: now, ExpiresAt: now.Add(QueueExpiryWindow)}
|
||||
ticket := QueueTicket{TicketID: ticketID, PlayerID: playerID, Candidate: candidate, Playlist: candidate.Playlist, State: Queued, EnqueuedAt: now, ExpiresAt: now.Add(QueueExpiryWindow)}
|
||||
q.tickets[ticketID] = ticket
|
||||
q.byPlayer[playerID] = ticketID
|
||||
q.mutations[idempotencyKey] = queueMutation{digest: digest, ticket: ticket}
|
||||
|
||||
Reference in New Issue
Block a user