config: add an option to set pool size manually

Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2020-11-23 00:29:39 +05:30
parent 3d2c8db5ba
commit a0642019c2
No known key found for this signature in database
GPG Key ID: DD0B4C26654BA8E4

View File

@ -7,7 +7,8 @@ pub type Pool = r2d2::Pool<ConnectionManager<PgConnection>>;
pub fn pool() -> Pool {
let manager = ConnectionManager::<PgConnection>::new(database_url());
Pool::builder().max_size(15).build(manager).unwrap()
let pool_size = env::var("KATBIN_POOL_SIZE").unwrap().parse::<u32>().expect("pool size");
Pool::builder().max_size(pool_size).build(manager).unwrap()
}
fn database_url() -> String {