diff --git a/Cargo.lock b/Cargo.lock index 4b345d12..2f5b381e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3503,24 +3503,17 @@ dependencies = [ [[package]] name = "nanoservices-utils" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a95cdb2ba5dc6584099b1aac8da0a6f80e12ad5f9381a19d232c1fee714793" +checksum = "63a4117f6ebfcfe84722ef283fd6e3bfcaa141718f3ff092343bb6cb98482e03" dependencies = [ - "actix-web", - "bincode", "bitcode", - "bytes", "chrono", "futures", - "jsonwebtoken", "paste", "revision 0.7.1", "serde", - "serde_json", "thiserror", - "tokio", - "tokio-util", ] [[package]] @@ -5990,9 +5983,9 @@ dependencies = [ [[package]] name = "surrealcs" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "457eb2adc59f9a9ba337e1fa3a6af63e09524e4adf01921b9d7079917cd7f694" +checksum = "b28a50184a9a743ac180985d8b94ac4c93e4afaa0140f1057d3b11d4d36b9e8b" dependencies = [ "bincode", "bytes", @@ -6011,9 +6004,9 @@ dependencies = [ [[package]] name = "surrealcs-kernel" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a79da58bfc886b93a431a463f956184d4b0a9d3672833544a1b718ff86b0df" +checksum = "ab2a5ba4af373b48fa241a81676d0172fc92e563df217282c472252b90beafee" dependencies = [ "bincode", "chrono", diff --git a/core/Cargo.toml b/core/Cargo.toml index 45fad5e3..eb1fa62a 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -147,7 +147,7 @@ sha2 = "0.10.8" snap = "1.1.0" storekey = "0.5.0" subtle = "2.6" -surrealcs = { version = "0.3.1", optional = true } +surrealcs = { version = "0.3.2", optional = true } surrealkv = { version = "0.3.6", optional = true } surrealml = { version = "0.1.1", optional = true, package = "surrealml-core" } tempfile = { version = "3.10.1", optional = true } diff --git a/core/src/kvs/surrealcs/cnf.rs b/core/src/kvs/surrealcs/cnf.rs new file mode 100644 index 00000000..c7ad6d81 --- /dev/null +++ b/core/src/kvs/surrealcs/cnf.rs @@ -0,0 +1,4 @@ +use std::sync::LazyLock; + +pub static SURREALCS_CONNECTION_POOL_SIZE: LazyLock = + lazy_env_parse_or_else!("SURREAL_SURREALCS_CONNECTION_POOL_SIZE", usize, |_| num_cpus::get()); diff --git a/core/src/kvs/surrealcs/mod.rs b/core/src/kvs/surrealcs/mod.rs index 5234b958..e11643c9 100644 --- a/core/src/kvs/surrealcs/mod.rs +++ b/core/src/kvs/surrealcs/mod.rs @@ -1,5 +1,7 @@ #![cfg(feature = "kv-surrealcs")] +mod cnf; + use crate::err::Error; use crate::key::debug::Sprintable; use crate::kvs::savepoint::{SaveOperation, SavePointImpl, SavePoints}; @@ -72,7 +74,7 @@ impl Drop for Transaction { impl Datastore { /// Open a new database pub(crate) async fn new(path: &str) -> Result { - match create_connection_pool(path, None).await { + match create_connection_pool(path, Some(*cnf::SURREALCS_CONNECTION_POOL_SIZE)).await { Ok(_) => Ok(Datastore {}), Err(_) => { Err(Error::Ds("Cannot connect to the `surrealcs` storage engine".to_string()))