diff --git a/src/main.rs b/src/main.rs index 7951a3358bb582a18f422814a114fa76f79ce6e3..5b23a5d45aac8476fc2f64526d576fbd982bebe0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,7 +46,14 @@ fn main() { let redis_connstring = var("REDIS_CONNSTRING").unwrap_or_else(|_| String::from("redis://localhost")); let manager = r2d2_redis::RedisConnectionManager::new(&*redis_connstring).unwrap(); let pool = r2d2::Pool::builder() + // At least 1 connection must be active + .min_idle(Some(2)) + // Try to get a connection for max 1 second .connection_timeout(Duration::from_secs(1)) + // Don't log errors directly. + // They can get quite verbose, and we're already catching and + // logging the corresponding results anyways. + .error_handler(Box::new(r2d2::NopErrorHandler)) .build(manager) .unwrap();