-
Notifications
You must be signed in to change notification settings - Fork 221
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Hey, Im trying for 2 days now to make this work,
How do I pass the session from an endpoint to the background worker function?
My idea is to insert a record in the db from my endpoint then process it from the background function.
Edit
I made it work by creating another function with contextmanager
@asynccontextmanager
async def async_get_context() -> AsyncSession:
async_session = local_session
async with async_session() as db:
yield db
igorbenav
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request