mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-03 18:42:43 +00:00
Add pre-conditions to avoid on_timeout being called after stop()
Apparently the cancellation request for a TimerHandle doesn't necessarily have to be honoured despite large periods of time passing
This commit is contained in:
parent
876b1e0f3e
commit
81e9d70b7b
@ -314,8 +314,10 @@ class View:
|
||||
self._timeout_handler = loop.call_later(self.timeout, self.dispatch_timeout)
|
||||
|
||||
def dispatch_timeout(self):
|
||||
if not self._stopped.done():
|
||||
self._stopped.set_result(True)
|
||||
if self._stopped.done():
|
||||
return
|
||||
|
||||
self._stopped.set_result(True)
|
||||
asyncio.create_task(self.on_timeout(), name=f'discord-ui-view-timeout-{self.id}')
|
||||
|
||||
def dispatch(self, state: Any, item: Item, interaction: Interaction):
|
||||
|
Loading…
x
Reference in New Issue
Block a user