Skip to content

Commit

Permalink
hotfix for anyio changes
Browse files Browse the repository at this point in the history
  • Loading branch information
trisongz committed Jan 5, 2024
1 parent 339cecc commit 069584b
Show file tree
Hide file tree
Showing 6 changed files with 353 additions and 69 deletions.
8 changes: 5 additions & 3 deletions aiokeydb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from aiokeydb.serializers import SerializerType, BaseSerializer
from aiokeydb.utils.lazy import get_keydb_settings
from aiokeydb.utils.logs import logger

from aiokeydb.utils.helpers import afail_after

class KeyDBClientMeta(type):

Expand Down Expand Up @@ -4512,7 +4512,8 @@ async def afail_after(
Context manager that will fail after a certain timeout
"""
try:
async with anyio.fail_after(timeout):
# async with anyio.fail_after(timeout):
async with afail_after(timeout):
yield
except Exception as e:
if verbose:
Expand Down Expand Up @@ -4913,7 +4914,8 @@ async def _get_sess_ctx():
if _sess_ctx: return _sess_ctx
_sess = cls.get_session(_session)
with contextlib.suppress(Exception):
async with anyio.fail_after(1.0):
# async with anyio.fail_after(1.0):
async with afail_after(1.0):
if await _sess.async_ping(): _sess_ctx = _sess

return _sess_ctx
Expand Down
Loading

0 comments on commit 069584b

Please sign in to comment.