Optimise VoiceState for memory.

Instead of storing one VoiceState per Member, only store them if
necessary. This should bring down the number of instances
significantly.
This commit is contained in:
Rapptz
2016-10-09 05:37:37 -04:00
parent 044b0824e6
commit 31229a53e9
4 changed files with 74 additions and 81 deletions

View File

@ -117,8 +117,7 @@ class GroupCall:
if data['channel_id'] is None:
self._voice_states.pop(user_id, None)
else:
data['voice_channel'] = self.channel
self._voice_states[user_id] = VoiceState(**data)
self._voice_states[user_id] = VoiceState(data=data, channel=self.channel)
@property
def connected(self):