Skip to content

Commit

Permalink
PYTHON-1313 Fix asyncio removals in Python 3.10 (#1179)
Browse files Browse the repository at this point in the history
  • Loading branch information
absurdfarce authored Oct 13, 2023
1 parent a7ab8cc commit e9136f4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cassandra/io/asyncioreactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ def end(self):

def __init__(self, timeout, callback, loop):
delayed = self._call_delayed_coro(timeout=timeout,
callback=callback,
loop=loop)
callback=callback)
self._handle = asyncio.run_coroutine_threadsafe(delayed, loop=loop)

@staticmethod
async def _call_delayed_coro(timeout, callback, loop):
await asyncio.sleep(timeout, loop=loop)
async def _call_delayed_coro(timeout, callback):
await asyncio.sleep(timeout)
return callback()

def __lt__(self, other):
Expand Down Expand Up @@ -90,8 +89,8 @@ def __init__(self, *args, **kwargs):
self._connect_socket()
self._socket.setblocking(0)

self._write_queue = asyncio.Queue(loop=self._loop)
self._write_queue_lock = asyncio.Lock(loop=self._loop)
self._write_queue = asyncio.Queue()
self._write_queue_lock = asyncio.Lock()

# see initialize_reactor -- loop is running in a separate thread, so we
# have to use a threadsafe call
Expand Down

0 comments on commit e9136f4

Please sign in to comment.