mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Adaptive heap size (#328)
* heap-size is a CLI arg, make it 512 by default * Fix tests * Adaptive heap size. * Allow storage_exists
This commit is contained in:
@@ -237,6 +237,13 @@ pub fn run<I, T, W>(args: I, worker: W) -> error::Result<()> where
|
||||
service::Roles::FULL
|
||||
};
|
||||
|
||||
if let Some(v) = matches.value_of("min-heap-pages") {
|
||||
config.min_heap_pages = v.parse().map_err(|_| "Invalid --min-heap-pages argument")?;
|
||||
}
|
||||
if let Some(v) = matches.value_of("max-heap-pages") {
|
||||
config.max_heap_pages = v.parse().map_err(|_| "Invalid --max-heap-pages argument")?;
|
||||
}
|
||||
|
||||
if let Some(s) = matches.value_of("execution") {
|
||||
config.execution_strategy = match s {
|
||||
"both" => service::ExecutionStrategy::Both,
|
||||
@@ -393,6 +400,23 @@ fn import_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
|
||||
let base_path = base_path(matches);
|
||||
let mut config = service::Configuration::default_with_spec(spec);
|
||||
config.database_path = db_path(&base_path, config.chain_spec.id()).to_string_lossy().into();
|
||||
|
||||
if let Some(v) = matches.value_of("min-heap-pages") {
|
||||
config.min_heap_pages = v.parse().map_err(|_| "Invalid --min-heap-pages argument")?;
|
||||
}
|
||||
if let Some(v) = matches.value_of("max-heap-pages") {
|
||||
config.max_heap_pages = v.parse().map_err(|_| "Invalid --max-heap-pages argument")?;
|
||||
}
|
||||
|
||||
if let Some(s) = matches.value_of("execution") {
|
||||
config.execution_strategy = match s {
|
||||
"both" => service::ExecutionStrategy::Both,
|
||||
"native" => service::ExecutionStrategy::NativeWhenPossible,
|
||||
"wasm" => service::ExecutionStrategy::AlwaysWasm,
|
||||
_ => return Err(error::ErrorKind::Input("Invalid execution mode specified".to_owned()).into()),
|
||||
};
|
||||
}
|
||||
|
||||
let client = service::new_client(config)?;
|
||||
let (exit_send, exit_recv) = std::sync::mpsc::channel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user