Remove _get_poll lookup in Message constructor

This was triggering a terrible performance regression for no good
reason for all created messages that didn't have a poll, which is
essentially 99.99% of messages leading to MESSAGE_CREATE dispatches
having degraded performance.
This commit is contained in:
Rapptz
2024-08-31 08:29:05 -04:00
parent dee5bf65c6
commit 733c583b72
3 changed files with 1 additions and 12 deletions

View File

@ -1849,7 +1849,7 @@ class Message(PartialMessage, Hashable):
try:
self.poll = Poll._from_data(data=data['poll'], message=self, state=state)
except KeyError:
self.poll = state._get_poll(self.id)
pass
try:
# if the channel doesn't have a guild attribute, we handle that