mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-12 13:49:59 +08:00
Refine the env variable and the max readers
This commit is contained in:
parent
b605549bf2
commit
3bbad823e0
@ -1,6 +1,7 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::env::VarError;
|
use std::env::VarError;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::str::FromStr;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use meilisearch_types::heed::{EnvClosingEvent, EnvFlags, EnvOpenOptions};
|
use meilisearch_types::heed::{EnvClosingEvent, EnvFlags, EnvOpenOptions};
|
||||||
@ -301,17 +302,15 @@ fn create_or_open_index(
|
|||||||
enable_mdb_writemap: bool,
|
enable_mdb_writemap: bool,
|
||||||
map_size: usize,
|
map_size: usize,
|
||||||
) -> Result<Index> {
|
) -> Result<Index> {
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
let mut options = EnvOpenOptions::new();
|
let mut options = EnvOpenOptions::new();
|
||||||
options.map_size(clamp_to_page_size(map_size));
|
options.map_size(clamp_to_page_size(map_size));
|
||||||
|
|
||||||
let max_readers = match std::env::var("MEILI_INDEX_MAX_READERS") {
|
let max_readers = match std::env::var("MEILI_EXPERIMENTAL_INDEX_MAX_READERS") {
|
||||||
Ok(value) => u32::from_str(&value).unwrap(),
|
Ok(value) => u32::from_str(&value).unwrap(),
|
||||||
Err(VarError::NotPresent) => 100 * 1024,
|
Err(VarError::NotPresent) => 1024,
|
||||||
Err(VarError::NotUnicode(value)) => {
|
Err(VarError::NotUnicode(value)) => panic!(
|
||||||
panic!("Invalid unicode for the `MEILI_INDEX_MAX_READERS` env var: {value:?}")
|
"Invalid unicode for the `MEILI_EXPERIMENTAL_INDEX_MAX_READERS` env var: {value:?}"
|
||||||
}
|
),
|
||||||
};
|
};
|
||||||
options.max_readers(max_readers);
|
options.max_readers(max_readers);
|
||||||
if enable_mdb_writemap {
|
if enable_mdb_writemap {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user