Open KevinBongart opened 4 years ago
Here's an example of an issue that happened a few hours ago:
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_games_on_slug"
DETAIL: Key (slug)=(SJJZK) already exists.
Game slugs are being generated once when creating a game, but the logic doesn't check that its unique before sending it to the database (which does enforce uniqueness). There is no logic rescuing from a non-unique slug.
A loop should generate a slug, check for uniqueness, attempt to store it and rescue (and retry) if it fails.