Skip to content

Commit b645949

Browse files
committed
Add documentation to diesel's r2d2 module on what happens when
connections fail inside a pool fix docstring
1 parent a12f95f commit b645949

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

diesel/src/r2d2.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
//! Connection pooling via r2d2.
22
//!
33
//! Note: This module requires enabling the `r2d2` feature
4+
//!
5+
//! When used inside a pool, if an individual connection becomes
6+
//! broken (as determined by the [R2D2Connection::is_broken] method)
7+
//! then `r2d2` will put close and return the connection to the DB.
8+
//!
9+
//! `diesel` determines broken connections by whether or not the current
10+
//! thread is panicking or if individual `Connection` structs are
11+
//! broken (determined by the `is_broken()` method). Generically, these
12+
//! are left to individual backends to implement themselves.
13+
//!
14+
//! For SQLite, PG, and MySQL backends, specifically, `is_broken()`
15+
//! is determined by whether or not the `TransactionManagerStatus` (as a part
16+
//! of the `AnsiTransactionManager` struct) is in an `InError` state.
17+
//!
418
519
pub use r2d2::*;
620

0 commit comments

Comments
 (0)