Update tokio to 0.2 again and remove TaskExecutors (#786)

* upgrade tokio again

* Remove WrappedExecutor

* switch to spawn_blocking
This commit is contained in:
Ashley
2020-01-29 12:13:47 +01:00
committed by GitHub
parent aa86197ec9
commit 04eae615b5
14 changed files with 63 additions and 134 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ parking_lot = "0.9.0"
derive_more = "0.99"
log = "0.4.8"
futures = "0.3.1"
tokio = { version = "0.2.4", features = ["rt-core"] }
tokio = { version = "0.2.10", features = ["rt-core"] }
exit-future = "0.2.0"
codec = { package = "parity-scale-codec", version = "1.1.0", features = ["derive"] }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
+2 -5
View File
@@ -58,9 +58,6 @@ use worker::{
use store::{Store as InnerStore};
/// Abstraction over an executor that lets you spawn tasks in the background.
pub(crate) type TaskExecutor = Arc<dyn Spawn + Send + Sync>;
const LOG_TARGET: &str = "availability";
/// Configuration for the availability store.
@@ -197,7 +194,7 @@ impl Store {
&self,
wrapped_block_import: I,
client: Arc<P>,
thread_pool: TaskExecutor,
spawner: impl Spawn,
keystore: KeyStorePtr,
) -> ClientResult<AvailabilityBlockImport<I, P>>
where
@@ -213,7 +210,7 @@ impl Store {
self.inner.clone(),
client,
wrapped_block_import,
thread_pool,
spawner,
keystore,
to_worker,
);
+4 -4
View File
@@ -37,12 +37,12 @@ use polkadot_primitives::parachain::{
CandidateReceipt, ParachainHost, ValidatorId,
ValidatorPair, AvailableMessages, BlockData, ErasureChunk,
};
use futures::{prelude::*, future::select, channel::{mpsc, oneshot}, task::SpawnExt};
use futures::{prelude::*, future::select, channel::{mpsc, oneshot}, task::{Spawn, SpawnExt}};
use keystore::KeyStorePtr;
use tokio::runtime::{Handle, Runtime as LocalRuntime};
use crate::{LOG_TARGET, Data, TaskExecutor, ProvideGossipMessages, erasure_coding_topic};
use crate::{LOG_TARGET, Data, ProvideGossipMessages, erasure_coding_topic};
use crate::store::Store;
/// Errors that may occur.
@@ -747,7 +747,7 @@ impl<I, P> AvailabilityBlockImport<I, P> {
availability_store: Store,
client: Arc<P>,
block_import: I,
thread_pool: TaskExecutor,
spawner: impl Spawn,
keystore: KeyStorePtr,
to_worker: mpsc::UnboundedSender<WorkerMsg>,
) -> Self
@@ -771,7 +771,7 @@ impl<I, P> AvailabilityBlockImport<I, P> {
exit.clone()
).map(drop);
if let Err(_) = thread_pool.spawn(Box::new(prune_available)) {
if let Err(_) = spawner.spawn(prune_available) {
error!(target: LOG_TARGET, "Failed to spawn availability pruning task");
exit_signal = None;
}