(&mut self)
| 207 | |
| 208 | impl Drop for PooledConnection<'_> { |
| 209 | fn drop(&mut self) { |
| 210 | if let Some(conn) = self.conn.take() { |
| 211 | // Synchronous return to idle queue — no async, no spawned tasks. |
| 212 | let mut idle = self.inner.idle.lock().unwrap_or_else(|e| e.into_inner()); |
| 213 | if idle.len() < self.inner.max_size { |
| 214 | idle.push_back(conn); |
| 215 | } |
| 216 | // else: too many idle connections — drop this one. |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | #[cfg(test)] |