Skip to content

Commit

Permalink
Use AnyIO fast_acquire
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusSintonen committed Sep 19, 2024
1 parent 711292e commit e7d8601
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions httpcore/_synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def setup(self) -> None:
if self._backend == "trio":
self._trio_lock = trio.Lock()
elif self._backend == "asyncio":
self._anyio_lock = anyio.Lock()
self._anyio_lock = anyio.Lock(fast_acquire=True)

async def __aenter__(self) -> "AsyncLock":
if not self._backend:
Expand Down Expand Up @@ -167,7 +167,7 @@ def setup(self) -> None:
)
elif self._backend == "asyncio":
self._anyio_semaphore = anyio.Semaphore(
initial_value=self._bound, max_value=self._bound
initial_value=self._bound, max_value=self._bound, fast_acquire=True
)

async def acquire(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ trio = [
"trio>=0.22.0,<0.26.0",
]
asyncio = [
"anyio>=4.0,<5.0",
"anyio>=4.5.0,<5.0",
]

[project.urls]
Expand Down

0 comments on commit e7d8601

Please sign in to comment.