diff --git a/src/kiwipy/rmq/tasks.py b/src/kiwipy/rmq/tasks.py index 29563d6..4fc1e6f 100644 --- a/src/kiwipy/rmq/tasks.py +++ b/src/kiwipy/rmq/tasks.py @@ -2,7 +2,6 @@ import asyncio import collections from contextlib import asynccontextmanager -from functools import partial import logging from typing import Generator, Optional import uuid @@ -21,12 +20,6 @@ TaskInfo = collections.namedtuple('TaskBody', ('task', 'no_reply')) -try: - run_coroutine = asyncio.eager_task_factory -except AttributeError: - # For Python older than 3.12 - run_coroutine = asyncio.run_coroutine_threadsafe - class RmqTaskSubscriber(messages.BaseConnectionWithExchange): """ @@ -318,7 +311,7 @@ def _outcome_destroyed(self, outcome_ref): assert outcome_ref is self._outcome_ref # This task will not be processed self._outcome_ref = None - partial(run_coroutine, loop=self._loop)(coro=self.requeue()) + asyncio.run_coroutine_threadsafe(self.requeue(), loop=self._loop) def _finalise(self): self._outcome_ref = None