Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating room due to some duplicate entry of affinity_topic and game_id #121

Open
Tracked by #135
dennyabrain opened this issue Jun 19, 2023 · 0 comments
Open
Tracked by #135
Assignees
Labels
level: ticket: code tickets tied to new feature development/change requests level:ticket An issue that describes a ticket (initiative>feature>ticket) priority:high role:backend
Milestone

Comments

@dennyabrain
Copy link
Contributor

dennyabrain commented Jun 19, 2023

This error prevents us room creation.

On the UI when you click create room, you might see "error" in the notifications.
The stack trace looks like this

received event "create_game" from koMVb2dS8Wf4xH9TAAAC [/]
Incoming event - create_game | {'player_count': '2', 'colors_filepath': 'config_jsons/example1/colors.json', 'topics_filepath': 'config_jsons/example1/topics.json', 'password': 'asdf', 'draw_fn_name': 'first', 'cards_filepath': 'config_jsons/example1/cards.json', 'encyclopedia_filepath': 'config_jsons/example1/articles.json'}
emitting event "create_room:progress" to koMVb2dS8Wf4xH9TAAAC [/]
emitting event "create_room:progress" to koMVb2dS8Wf4xH9TAAAC [/]
emitting event "error" to koMVb2dS8Wf4xH9TAAAC [/]
(1062, "Duplicate entry 'cats-7d8a74e0d09348f1b36c0fa24cbf2c36' for key 'affinitytopic.affinitytopic_name_game_id'")
Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 3237, in execute_sql
    cursor.execute(sql, params or ())
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
MySQLdb.IntegrityError: (1062, "Duplicate entry 'cats-7d8a74e0d09348f1b36c0fa24cbf2c36' for key 'affinitytopic.affinitytopic_name_game_id'")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/flask_socketio/__init__.py", line 828, in _handle_event
    ret = handler(*args)
  File "/app/main_loop/websocket.py", line 349, in create_game
    for progress in WebsocketGameRunner.create(
  File "/app/main_loop/websocket.py", line 239, in create
    for progress in Game.new(**game_kwargs):
  File "/app/models/base.py", line 230, in new
    topic_objs.append(AffinityTopic.create(name=topic_name, game=game))
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 6532, in create
    inst.save(force_insert=True)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 6742, in save
    pk = self.insert(**field_dict).execute()
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 1962, in inner
    return method(self, database, *args, **kwargs)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 2033, in execute
    return self._execute(database)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 2838, in _execute
    return super(Insert, self)._execute(database)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 2551, in _execute
    cursor = database.execute(self)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 3250, in execute
    return self.execute_sql(sql, params, commit=commit)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 3244, in execute_sql
    self.commit()
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 3010, in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 192, in reraise
    raise value.with_traceback(tb)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/peewee.py", line 3237, in execute_sql
    cursor.execute(sql, params or ())
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
peewee.IntegrityError: (1062, "Duplicate entry 'cats-7d8a74e0d09348f1b36c0fa24cbf2c36' for key 'affinitytopic.affinitytopic_name_game_id'")
@dennyabrain dennyabrain converted this from a draft issue Jun 19, 2023
@dennyabrain dennyabrain added this to the 0.2.0 milestone Jun 19, 2023
@dennyabrain dennyabrain moved this from Todo to In Progress in Viral Spiral 2023 Jun 20, 2023
@dennyabrain dennyabrain moved this to Todo in 2023 Q3 Planner Jul 1, 2023
@dennyabrain dennyabrain self-assigned this Jul 14, 2023
@dennyabrain dennyabrain added level: ticket: code tickets tied to new feature development/change requests level:ticket An issue that describes a ticket (initiative>feature>ticket) priority:high role:backend labels Jul 14, 2023
@dennyabrain dennyabrain moved this to In Progress in 2023 Q3 Planner Jul 14, 2023
@dennyabrain dennyabrain moved this from In Progress to Done in 2023 Q3 Planner Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level: ticket: code tickets tied to new feature development/change requests level:ticket An issue that describes a ticket (initiative>feature>ticket) priority:high role:backend
Projects
Status: In Progress
Status: Done
Development

No branches or pull requests

1 participant