Skip to content

Commit

Permalink
Revert "Switch to asyncio.eager_task_factory for Python 3.12"
Browse files Browse the repository at this point in the history
This reverts commit a070bfe.
  • Loading branch information
sphuber committed Dec 1, 2024
1 parent bd96317 commit 7059d24
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/kiwipy/rmq/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
"""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7059d24

Please sign in to comment.