Skip to content

DatabaseConnection clone creates a new pool? #2198

Answered by billy1624
ziimakc asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @ziimakc, sorry I make a mistake.

sea_orm::DatabaseConnection is based on sqlx::Pool.

As stated in the SQLx documentation.

Cloning Pool is cheap as it is simply a reference-counted handle to the inner pool state. When the last remaining handle to the pool is dropped, the connections owned by the pool are immediately closed (also by dropping).

So, the connection pool above will keep at least 5 active connections at all time and at most 100 connections. You can feel free to clone sea_orm::DatabaseConnection.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ziimakc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants