From a0642019c2fb2766976ab5cf1102697e01879669 Mon Sep 17 00:00:00 2001 From: SphericalKat Date: Mon, 23 Nov 2020 00:29:39 +0530 Subject: [PATCH] config: add an option to set pool size manually Signed-off-by: SphericalKat --- src/utils/db.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/db.rs b/src/utils/db.rs index 6532e46..dc20059 100644 --- a/src/utils/db.rs +++ b/src/utils/db.rs @@ -7,7 +7,8 @@ pub type Pool = r2d2::Pool>; pub fn pool() -> Pool { let manager = ConnectionManager::::new(database_url()); - Pool::builder().max_size(15).build(manager).unwrap() + let pool_size = env::var("KATBIN_POOL_SIZE").unwrap().parse::().expect("pool size"); + Pool::builder().max_size(pool_size).build(manager).unwrap() } fn database_url() -> String {