Skip to content

Commit

Permalink
Fix potential race condition in ConnectionWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
luyiming committed Jun 16, 2024
1 parent 531f6ad commit a955955
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tortoise/backends/base/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ async def ensure_connection(self) -> None:
self.connection = self.client._connection

async def __aenter__(self):
await self.ensure_connection()
await self.lock.acquire()
await self.ensure_connection()
return self.connection

async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
Expand Down

0 comments on commit a955955

Please sign in to comment.