Skip to content

Commit

Permalink
RUST-1231 Run tests using DEFAULT_MAX_POOL_SIZE (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
stIncMale authored Oct 31, 2023
1 parent 897843b commit 6d4e316
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/client/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ pub struct ConnectionString {
/// `max_pool_size` connections are checked out, the operation will block until an in-progress
/// operation finishes and its connection is checked back into the pool.
///
/// The default value is 100.
/// The default value is 10.
pub max_pool_size: Option<u32>,

/// The minimum number of connections that should be available in a server's connection pool at
Expand Down
2 changes: 1 addition & 1 deletion src/cmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use worker::ConnectionPoolWorker;
#[cfg(test)]
use crate::runtime::WorkerHandle;

const DEFAULT_MAX_POOL_SIZE: u32 = 10;
pub(crate) const DEFAULT_MAX_POOL_SIZE: u32 = 10;

/// A pool of connections implementing the CMAP spec.
/// This type is actually a handle to task that manages the connections and is cheap to clone and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use semver::VersionReq;
use serde::Deserialize;

use crate::{
cmap::DEFAULT_MAX_POOL_SIZE,
coll::options::FindOptions,
error::Result,
event::cmap::CmapEvent,
Expand Down Expand Up @@ -216,10 +217,9 @@ async fn load_balancing_test() {
let mut handler = EventHandler::new();
let mut subscriber = handler.subscribe();
let mut options = CLIENT_OPTIONS.get().await.clone();
let max_pool_size = 10;
let max_pool_size = DEFAULT_MAX_POOL_SIZE;
let hosts = options.hosts.clone();
options.local_threshold = Duration::from_secs(30).into();
options.max_pool_size = Some(max_pool_size);
options.min_pool_size = Some(max_pool_size);
let client = TestClient::with_handler(Some(Arc::new(handler.clone())), options).await;

Expand Down
5 changes: 0 additions & 5 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ use crate::{
};
use std::{fs::read_to_string, str::FromStr};

const MAX_POOL_SIZE: u32 = 100;

lazy_static! {
pub(crate) static ref CLIENT_OPTIONS: AsyncOnce<ClientOptions> = AsyncOnce::new(async {
let mut options = ClientOptions::parse_uri(&*DEFAULT_URI, None).await.unwrap();
Expand Down Expand Up @@ -113,9 +111,6 @@ lazy_static! {
}

pub(crate) fn update_options_for_testing(options: &mut ClientOptions) {
if options.max_pool_size.is_none() {
options.max_pool_size = Some(MAX_POOL_SIZE);
}
if options.server_api.is_none() {
options.server_api = SERVER_API.clone();
}
Expand Down

0 comments on commit 6d4e316

Please sign in to comment.