Skip to content

Commit

Permalink
feat: use low level API to configure the API
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
vincenzopalazzo committed Feb 7, 2024
1 parent dd21877 commit 13d1f69
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
54 changes: 27 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion coffee_storage/src/nosql_db.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use async_trait::async_trait;
use coffee_lib::utils::check_dir_or_make_if_missing;
use nosql_db::NoSQL;
use nosql_sled::sled;
use nosql_sled::SledDB;

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

0 comments on commit 13d1f69

Please sign in to comment.