-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7067881
commit 54b6fea
Showing
2 changed files
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from sqlalchemy.ext.asyncio import AsyncSession | ||
|
||
from src.core.config import DB_SEMAPHORE | ||
from src.core.database.database import SessionFactory | ||
|
||
|
||
# Dependency to get an asynchronous session | ||
async def get_session() -> AsyncSession: | ||
async with SessionFactory() as session: | ||
yield session | ||
async with DB_SEMAPHORE: # Acquire semaphore before accessing the session | ||
async with SessionFactory() as session: | ||
yield session # Provide the session to the calling function |