mirror of
https://github.com/launchbadge/sqlx
synced 2024-09-20 22:31:56 +00:00
decrement pool size when connection is released
This commit is contained in:
parent
4c1cf86380
commit
f39d194b17
1 changed files with 10 additions and 2 deletions
|
@ -56,9 +56,13 @@ impl<DB: Database> DerefMut for 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 {
|
||||
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>> {
|
||||
Floating {
|
||||
inner: self.inner.into_idle(),
|
||||
|
|
Loading…
Reference in a new issue