AChelikani / Codenames

The board game, Codenames, but online!
2 stars 1 forks source link

"Out of avatars" error after refreshing the lobby repeatedly #14

Open tbroadley opened 6 years ago

tbroadley commented 6 years ago
  File "/home/thomas/Documents/src/Codenames/lobby_handlers.py", line 84, in client_connect
    data=cookie
  File "/home/thomas/Documents/src/Codenames/game_manager.py", line 57, in handle_client_event
    client, events = client_manager.handle_event(self.game_code, client_id, client_event, data)
  File "/home/thomas/Documents/src/Codenames/client_manager.py", line 74, in handle_event
    client = self.restore_client(existing_id)
  File "/home/thomas/Documents/src/Codenames/client_manager.py", line 212, in restore_client
    avatar = Player._get_avatar(self.used_avatars, pref=player.avatar)
  File "/home/thomas/Documents/src/Codenames/player.py", line 40, in _get_avatar
    raise ValueError('Out of avatars')
ValueError: Out of avatars

I think this happens because, every time the page is refreshed, all players tied to the device are assigned a new avatar by the server but don't end up using it on the client.

TheOrangeOne commented 6 years ago

yeah this is a really weird issue. i think it has to do with the cookie identifying a client gets lost, and then there end up being dangling clients in the lobby taking up avatars.