use std::time::Duration; use diesel::pg::PgConnection; use diesel::r2d2::{ConnectionManager, Pool}; pub type PgPool = Pool>; pub fn init_pool(database_url: &str) -> anyhow::Result { let manager = ConnectionManager::::new(database_url); let pool = Pool::builder() .max_size(16) .connection_timeout(Duration::from_secs(10)) .build(manager)?; Ok(pool) }