mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix _process_polling_updates being garbage collected (#1328)
This commit is contained in:
parent
88baf0b582
commit
192a5e5e64
1 changed files with 4 additions and 1 deletions
|
|
@ -88,6 +88,7 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
||||||
self._polling = False
|
self._polling = False
|
||||||
self._closed = True
|
self._closed = True
|
||||||
self._dispatcher_close_waiter = None
|
self._dispatcher_close_waiter = None
|
||||||
|
self._polling_tasks = set()
|
||||||
|
|
||||||
self._setup_filters()
|
self._setup_filters()
|
||||||
|
|
||||||
|
|
@ -395,7 +396,9 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
||||||
log.debug(f"Received {len(updates)} updates.")
|
log.debug(f"Received {len(updates)} updates.")
|
||||||
offset = updates[-1].update_id + 1
|
offset = updates[-1].update_id + 1
|
||||||
|
|
||||||
asyncio.create_task(self._process_polling_updates(updates, fast))
|
polling_task = asyncio.create_task(self._process_polling_updates(updates, fast))
|
||||||
|
self._polling_tasks.add(polling_task)
|
||||||
|
polling_task.add_done_callback(self._polling_tasks.discard)
|
||||||
|
|
||||||
if relax:
|
if relax:
|
||||||
await asyncio.sleep(relax)
|
await asyncio.sleep(relax)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue