FIX: Task.set_name only works on Python >= 3.8

This commit is contained in:
Fabio Manganiello 2022-11-21 09:49:57 +01:00
parent b8215d2736
commit 02f89258b8
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -158,6 +158,7 @@ class AsyncRunnablePlugin(RunnablePlugin, ABC):
asyncio.set_event_loop(self._loop) asyncio.set_event_loop(self._loop)
self._task = self._loop.create_task(self._listen()) self._task = self._loop.create_task(self._listen())
if hasattr(self._task, 'set_name'):
self._task.set_name(self.__class__.__name__ + '.listen') self._task.set_name(self.__class__.__name__ + '.listen')
self._loop.run_forever() self._loop.run_forever()