Change WEBHOOK_UPDATE to use guild information from gateway
This changes the lookup from unnecessary O(n) to two amortised O(1) lookups. This event pretty much always has a guild_id so the original code was always a performance bottleneck.
This commit is contained in:
parent
b4e39668fb
commit
826ce101fd
@ -1135,7 +1135,12 @@ class ConnectionState:
|
||||
log.debug('INTEGRATION_DELETE referencing an unknown guild ID: %s. Discarding.', guild_id)
|
||||
|
||||
def parse_webhooks_update(self, data):
|
||||
channel = self.get_channel(int(data['channel_id']))
|
||||
guild = self._get_guild(int(data['guild_id']))
|
||||
if guild is None:
|
||||
log.debug('WEBHOOKS_UPDATE referencing an unknown guild ID: %s. Discarding', data['guild_id'])
|
||||
return
|
||||
|
||||
channel = guild.get_channel(int(data['channel_id']))
|
||||
if channel is not None:
|
||||
self.dispatch('webhooks_update', channel)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user