mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
sql: use semaphore to limit access to the connection pool
This ensures that if multiple connections are returned to the pool at the same time, waiters get them in the order they were placed in the queue.
This commit is contained in:
@@ -338,7 +338,7 @@ impl Sql {
|
||||
pub(crate) async fn get_conn(&self) -> Result<PooledConnection> {
|
||||
let lock = self.pool.read().await;
|
||||
let pool = lock.as_ref().context("no SQL connection")?;
|
||||
let conn = pool.get().await;
|
||||
let conn = pool.get().await?;
|
||||
|
||||
Ok(conn)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user