From 02cf0ec38a5112a9b856583d5decaa421f71c8fa Mon Sep 17 00:00:00 2001 From: Michael Kryukov Date: Sun, 24 Apr 2022 20:57:46 +0300 Subject: [PATCH] fix: removed loop arguments --- CHANGELOG.md | 2 +- kutana/backends/telegram.py | 2 +- kutana/backends/vkontakte/callback.py | 2 +- kutana/kutana.py | 9 +++------ 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5e8222..6ea3c3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ - (Internal) Added `pick_by` to helpers. - (Telegram) Added support for `title` parameter in attachments (closes #66). - Fixes - - ^? (Core) Removed loop argument in kutana's semaphore. + - ^? (Core) Removed loop arguments for Lock, Queue e.t.c. - (Examples) "Document" now sends as actual document. - (i18n) `collect_from` option is now used. - (Telegram) `api_url` option is now used. diff --git a/kutana/backends/telegram.py b/kutana/backends/telegram.py index d144229..37c679c 100644 --- a/kutana/backends/telegram.py +++ b/kutana/backends/telegram.py @@ -314,7 +314,7 @@ async def on_start(self, app): self.username = me["username"] - self.api_messages_lock = asyncio.Lock(loop=app.get_loop()) + self.api_messages_lock = asyncio.Lock() async def send_message(self, target_id, message, attachments=(), **kwargs): """ diff --git a/kutana/backends/vkontakte/callback.py b/kutana/backends/vkontakte/callback.py index 629d9cb..17b6967 100644 --- a/kutana/backends/vkontakte/callback.py +++ b/kutana/backends/vkontakte/callback.py @@ -88,7 +88,7 @@ async def on_start(self, app): await super().on_start(app) # Setup queue - self.updates_queue = asyncio.Queue(self._queue_limit, loop=app.get_loop()) + self.updates_queue = asyncio.Queue(self._queue_limit) # Start web server await self.start_server() diff --git a/kutana/kutana.py b/kutana/kutana.py index cc622e9..e69d064 100644 --- a/kutana/kutana.py +++ b/kutana/kutana.py @@ -144,10 +144,7 @@ async def _main_loop_wrapper(self): raise async def _main_loop(self): - queue = asyncio.Queue( - maxsize=self._concurrent_handlers_count, - loop=self._loop - ) + queue = asyncio.Queue(maxsize=self._concurrent_handlers_count) await self._on_start(queue) @@ -245,7 +242,7 @@ async def _shutdown(self): tasks.append(self._handle_event("shutdown")) - await asyncio.gather(*tasks, loop=self._loop, return_exceptions=True) + await asyncio.gather(*tasks, return_exceptions=True) # Cancel everything else tasks = [] @@ -255,7 +252,7 @@ async def _shutdown(self): task.cancel() tasks.append(task) - await asyncio.gather(*tasks, loop=self._loop, return_exceptions=True) + await asyncio.gather(*tasks, return_exceptions=True) self._loop.stop()