Do not drop the task_manager for benchmarking stuff (#12147)

We can not drop the `task_manager` for benchmarking stuff, because otherwise stuff that may needs
this feature (like background signature verification) will fail. Besides the base path setup is
moved to `SharedParams` directly. Meaning any call to `base_path` will now directly return a tmp
path when `--dev` is given.
This commit is contained in:
Bastian Köcher
2022-09-02 09:27:00 +02:00
committed by GitHub
parent 2ff56f8bc8
commit 907144496e
5 changed files with 27 additions and 18 deletions
@@ -60,7 +60,7 @@ impl InsertKeyCmd {
let suri = utils::read_uri(self.suri.as_ref())?;
let base_path = self
.shared_params
.base_path()
.base_path()?
.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
let chain_id = self.shared_params.chain_id(self.shared_params.is_dev());
let chain_spec = cli.load_spec(&chain_id)?;
+1 -1
View File
@@ -485,7 +485,7 @@ impl CliConfiguration for RunCmd {
Ok(if self.tmp {
Some(BasePath::new_temp_dir()?)
} else {
match self.shared_params().base_path() {
match self.shared_params().base_path()? {
Some(r) => Some(r),
// If `dev` is enabled, we use the temp base path.
None if self.shared_params().is_dev() => Some(BasePath::new_temp_dir()?),
+1 -1
View File
@@ -125,7 +125,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
///
/// By default this is retrieved from `SharedParams`.
fn base_path(&self) -> Result<Option<BasePath>> {
Ok(self.shared_params().base_path())
self.shared_params().base_path()
}
/// Returns `true` if the node is for development or not
@@ -82,8 +82,13 @@ pub struct SharedParams {
impl SharedParams {
/// Specify custom base path.
pub fn base_path(&self) -> Option<BasePath> {
self.base_path.clone().map(Into::into)
pub fn base_path(&self) -> Result<Option<BasePath>, crate::Error> {
match &self.base_path {
Some(r) => Ok(Some(r.clone().into())),
// If `dev` is enabled, we use the temp base path.
None if self.is_dev() => Ok(Some(BasePath::new_temp_dir()?)),
None => Ok(None),
}
}
/// Specify the development chain.