Skip to content

Commit 13d1f69

Browse files
feat: use low level API to configure the API
Fixes the following error [2024-02-07T11:12:37Z ERROR sled::config] cache capacity is limited to the cgroup memory limit: 964485120 bytes Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent dd21877 commit 13d1f69

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

Cargo.lock

+27-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coffee_storage/src/nosql_db.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use async_trait::async_trait;
22
use coffee_lib::utils::check_dir_or_make_if_missing;
33
use nosql_db::NoSQL;
4+
use nosql_sled::sled;
45
use nosql_sled::SledDB;
56

67
use coffee_lib::error;
@@ -17,7 +18,8 @@ impl NoSQlStorage {
1718
pub async fn new(path: &str) -> Result<Self, CoffeeError> {
1819
let path = format!("{path}/storage");
1920
check_dir_or_make_if_missing(path.clone()).await?;
20-
let db = SledDB::new(&path).map_err(|err| error!("{err}"))?;
21+
let config = sled::Config::new().path(path).cache_capacity(1_000_000);
22+
let db = SledDB::try_from(config).map_err(|err| error!("{err}"))?;
2123
Ok(Self { inner: db })
2224
}
2325
}

0 commit comments

Comments
 (0)