mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 23:35:20 +00:00
decrement pool size when connection is released
This commit is contained in:
parent
4c1cf86380
commit
f39d194b17
@ -56,9 +56,13 @@ impl<DB: Database> DerefMut for PoolConnection<DB> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<DB: Database> PoolConnection<DB> {
|
impl<DB: Database> PoolConnection<DB> {
|
||||||
// explicitly release a connection from the pool
|
/// Explicitly release a connection from the pool
|
||||||
pub fn release(mut self) -> DB::Connection {
|
pub fn release(mut self) -> DB::Connection {
|
||||||
self.live.take().expect("PoolConnection double-dropped").raw
|
self.live
|
||||||
|
.take()
|
||||||
|
.expect("PoolConnection double-dropped")
|
||||||
|
.float(&self.pool)
|
||||||
|
.detach()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +158,10 @@ impl<'s, DB: Database> Floating<'s, Live<DB>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn detach(self) -> DB::Connection {
|
||||||
|
self.inner.raw
|
||||||
|
}
|
||||||
|
|
||||||
pub fn into_idle(self) -> Floating<'s, Idle<DB>> {
|
pub fn into_idle(self) -> Floating<'s, Idle<DB>> {
|
||||||
Floating {
|
Floating {
|
||||||
inner: self.inner.into_idle(),
|
inner: self.inner.into_idle(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user