fix Pool to remove possibility of "leaking" connections (#84)

* fix `Pool` to reduce possibility of "leaking" connections

now uses RAII guards to control `SharedPool::size`

* add smoke test for `Pool` to both Postgres and MySQL tests

add `Pool::is_closed()`

* fix documentation re: pool

* refactor pool implementation to not use futures oneshot channels

https://github.com/launchbadge/sqlx/pull/84#issuecomment-580476223

* run cargo fmt

* Pool: remove superfluous guard struct, document some internal methods
This commit is contained in:
Austin Bonander
2020-01-31 23:33:42 -08:00
committed by GitHub
parent 745c5c3957
commit eff7c9e125
8 changed files with 800 additions and 314 deletions

View File

@@ -18,9 +18,9 @@ use crate::postgres::PgError;
use crate::url::Url;
use crate::Result;
/// An asynchronous connection to a [Postgres] database.
/// An asynchronous connection to a [Postgres][super::Postgres] database.
///
/// The connection string expected by [Connection::open] should be a PostgreSQL connection
/// The connection string expected by [Connect::connect] should be a PostgreSQL connection
/// string, as documented at
/// <https://www.postgresql.org/docs/12/libpq-connect.html#LIBPQ-CONNSTRING>
///

View File

@@ -16,5 +16,5 @@ mod protocol;
mod row;
mod types;
/// An alias for [`Pool`], specialized for **Postgres**.
/// An alias for [`Pool`][crate::Pool], specialized for **Postgres**.
pub type PgPool = super::Pool<PgConnection>;