config: add an option to set pool size manually
Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
		
							parent
							
								
									3d2c8db5ba
								
							
						
					
					
						commit
						a0642019c2
					
				@ -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 {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user