generated from VLADIMIR/template
fix
This commit is contained in:
@@ -35,8 +35,10 @@ func (s *ParticipationService) AnswerParticipation(ctx context.Context, token, a
|
||||
return s.teamsRepo.AnswerParticipation(ctx, token, answer)
|
||||
}
|
||||
|
||||
// Stable, purpose-separated tokens keep links valid when an ambiguous SMTP failure is retried.
|
||||
// Only the hash is stored in the database; the signing secret must stay stable across workers/restarts.
|
||||
// Стабильные токены для разных целей сохраняют работоспособность ссылок при
|
||||
// повторе после неоднозначной ошибки SMTP.
|
||||
// В базе хранится только хеш; секрет подписи должен быть постоянным между
|
||||
// рабочими процессами и перезапусками.
|
||||
func participationToken(secret string, id int) string {
|
||||
mac := hmac.New(sha256.New, []byte(secret))
|
||||
fmt.Fprintf(mac, "team-participation:v1:%d", id)
|
||||
@@ -102,7 +104,7 @@ func (s *ParticipationService) sendParticipationEmails(ctx context.Context, send
|
||||
err = sender.Send(jobCtx, participationEmail(p, s.appBaseURL, token, location))
|
||||
}
|
||||
cancel()
|
||||
// Persist even when sending consumed the job's deadline.
|
||||
// Сохраняем результат даже если отправка исчерпала время задачи.
|
||||
saveCtx, saveCancel := context.WithTimeout(ctx, 10*time.Second)
|
||||
saveErr := s.teamsRepo.FinishParticipationEmail(saveCtx, p.TeamID, p.Attempts, err)
|
||||
saveCancel()
|
||||
|
||||
Reference in New Issue
Block a user