kev
kev

Reputation: 9765

Connection pool for beanie?

I have the following function in my code:

async def context(client_id: str)
    database = f'db_{client_id}'
    await init_beanie(
        database=database,
        document_models=[
           .. # quite a few models
        ],
    )

Every time I fetch something from the database I will execute above function (it could be a different client every time).

I don't know exactly what init_beanie does, but it seems there is an overhead calling it every time.

I looked through the docs and couldn't find something like a connection pool or similar. Does such thing exist or is it not necessary?

Upvotes: 0

Views: 23

Answers (0)

Related Questions