mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Update tokio to 0.2 again and remove TaskExecutors (#786)
* upgrade tokio again * Remove WrappedExecutor * switch to spawn_blocking
This commit is contained in:
@@ -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,
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user