mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Update some dependencies to prune duplicated crates with different version (#12560)
* sc-client-babe/sp-arithmetic-fuzzer: update num-bigint and num-rational to v0.4 * update lru 0.7.5 ==> v0.8.1 * pallet-example-offchain-worker: update lite-json v0.1.3 ==> v0.2.0 * update hyper 0.14.16 ==> 0.14.20, num-fromat 0.4.0 ==> 0.4.3 * pallet-mmr: update ckb-merkle-mountain-range v0.3.2 ==> v0.5.2 * update handlebars v4.2.2 ==> v4.3.5 * `runtime_cache_size` must always be at least 1 Signed-off-by: koushiro <koushiro.cqx@gmail.com> * default cache size with .min(1) Signed-off-by: koushiro <koushiro.cqx@gmail.com> * update hyper 0.14.20 ==> 0.14.22 Signed-off-by: koushiro <koushiro.cqx@gmail.com> * update lru 0.8.0 ==> 0.8.1 Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Apply suggestions from code review * Apply suggestions from code review * Fix Cargo.lock Signed-off-by: koushiro <koushiro.cqx@gmail.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
@@ -32,6 +32,7 @@ use sc_executor_common::{
|
||||
use sp_core::traits::{Externalities, FetchRuntimeCode, RuntimeCode};
|
||||
use sp_version::RuntimeVersion;
|
||||
use std::{
|
||||
num::NonZeroUsize,
|
||||
panic::AssertUnwindSafe,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
@@ -179,17 +180,15 @@ impl RuntimeCache {
|
||||
/// for caching.
|
||||
///
|
||||
/// `runtime_cache_size` specifies the number of different runtimes versions preserved in an
|
||||
/// in-memory cache.
|
||||
/// in-memory cache, must always be at least 1.
|
||||
pub fn new(
|
||||
max_runtime_instances: usize,
|
||||
cache_path: Option<PathBuf>,
|
||||
runtime_cache_size: u8,
|
||||
) -> RuntimeCache {
|
||||
RuntimeCache {
|
||||
runtimes: Mutex::new(LruCache::new(runtime_cache_size.into())),
|
||||
max_runtime_instances,
|
||||
cache_path,
|
||||
}
|
||||
let cap =
|
||||
NonZeroUsize::new(runtime_cache_size.max(1) as usize).expect("cache size is not zero");
|
||||
RuntimeCache { runtimes: Mutex::new(LruCache::new(cap)), max_runtime_instances, cache_path }
|
||||
}
|
||||
|
||||
/// Prepares a WASM module instance and executes given function for it.
|
||||
|
||||
Reference in New Issue
Block a user