bug(lib): drop env on last use

fixes the `too many open files` error when running tests by closing the
environment on last drop
This commit is contained in:
Marin Postma 2021-12-15 17:55:39 +01:00
parent ea0a5271f7
commit b28a465304
8 changed files with 51 additions and 24 deletions

View file

@ -1,4 +1,5 @@
use std::path::Path;
use std::sync::Arc;
use heed::EnvOpenOptions;
use log::info;
@ -26,7 +27,7 @@ pub fn load_dump(
let mut options = EnvOpenOptions::new();
options.map_size(meta_env_size);
options.max_dbs(100);
let env = options.open(&dst)?;
let env = Arc::new(options.open(&dst)?);
IndexResolver::load_dump(
src.as_ref(),

View file

@ -192,7 +192,7 @@ impl IndexControllerBuilder {
options.map_size(task_store_size);
options.max_dbs(20);
let meta_env = options.open(&db_path)?;
let meta_env = Arc::new(options.open(&db_path)?);
let update_file_store = UpdateFileStore::new(&db_path)?;
// Create or overwrite the version file for this DB