generated from VLADIMIR/template
fix
This commit is contained in:
@@ -76,7 +76,7 @@ func (r *TeamsRepo) AnswerParticipation(ctx context.Context, token, answer strin
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// The condition is rechecked after a concurrent answer releases its row lock.
|
||||
// Условие проверяется повторно после снятия блокировки строки конкурентным ответом.
|
||||
_, err = r.pool.Exec(ctx, `WITH eligible_game AS (SELECT g.id FROM games g JOIN teams t ON t.game_id=g.id
|
||||
WHERE t.participation_token_hash=$1 AND g.status='draft' AND g.start_at > (clock_timestamp() AT TIME ZONE 'UTC') FOR SHARE OF g)
|
||||
UPDATE teams t SET participation_status=$2,
|
||||
@@ -99,7 +99,8 @@ func (r *TeamsRepo) AnswerParticipation(ctx context.Context, token, answer strin
|
||||
return p, ErrParticipationClosed
|
||||
}
|
||||
|
||||
// A five-minute lease survives restarts and keeps concurrent workers from sending the same job.
|
||||
// Пятиминутная аренда переживает перезапуски и не позволяет рабочим процессам
|
||||
// отправить одну задачу повторно.
|
||||
func (r *TeamsRepo) ClaimParticipationEmail(ctx context.Context) (*Participation, error) {
|
||||
p := &Participation{}
|
||||
err := r.pool.QueryRow(ctx, `WITH candidate AS (
|
||||
|
||||
@@ -212,7 +212,7 @@ func (r *TeamsRepo) RegisterTeamWithParticipation(ctx context.Context, gameID in
|
||||
return id, err
|
||||
}
|
||||
|
||||
// GetActiveTeamsByGameID excludes cancelled registrations from gameplay exports and results.
|
||||
// GetActiveTeamsByGameID исключает отменённые регистрации из игровых выгрузок и результатов.
|
||||
func (r *TeamsRepo) GetActiveTeamsByGameID(ctx context.Context, gameID int) ([]*repos.Team, error) {
|
||||
teams, err := r.GetTeamsByGameID(ctx, gameID)
|
||||
active := teams[:0]
|
||||
|
||||
Reference in New Issue
Block a user