Skip to content

Commit

Permalink
Don't open connnection with loop for python 3.10
Browse files Browse the repository at this point in the history
Originally posted in NoneGG/aredis#208
  • Loading branch information
alisaifee committed Jan 5, 2022
1 parent 0d9b4da commit d1de656
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions coredis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,21 @@ def __init__(self, host='127.0.0.1', port=6379, password=None,
self.socket_keepalive_options = socket_keepalive_options or {}

async def _connect(self):
if LOOP_DEPRECATED:
connection = asyncio.open_connection(
host=self.host,
port=self.port,
ssl=self.ssl_context
)
else:
connection = asyncio.open_connection(
host=self.host,
port=self.port,
ssl=self.ssl_context,
loop=self.loop
)
reader, writer = await exec_with_timeout(
asyncio.open_connection(host=self.host,
port=self.port,
ssl=self.ssl_context,
loop=self.loop),
connection,
self._connect_timeout,
loop=self.loop
)
Expand Down Expand Up @@ -642,10 +652,19 @@ def __init__(self, path='', password=None,
}

async def _connect(self):
if LOOP_DEPRECATED:
connection = asyncio.open_unix_connection(
path=self.path,
ssl=self.ssl_context
)
else:
connection = asyncio.open_unix_connection(
path=self.path,
ssl=self.ssl_context,
loop=self.loop
)
reader, writer = await exec_with_timeout(
asyncio.open_unix_connection(path=self.path,
ssl=self.ssl_context,
loop=self.loop),
connection,
self._connect_timeout,
loop=self.loop
)
Expand Down

0 comments on commit d1de656

Please sign in to comment.