Skip to content

Commit

Permalink
Revert "Revert "Revert removal of tokio_executor that causes tokio ve…
Browse files Browse the repository at this point in the history
…rsion mismatch panic"" (paritytech#685)

This reverts commit 938f411a9365e9c5fb16bfedb62aacac4403d063.
  • Loading branch information
expenses authored and gavofyork committed Dec 11, 2019
1 parent a036b4c commit 5e5a759
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions validation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tokio = { version = "0.2.4", features = ["rt-core", "blocking"] }
derive_more = "0.14.1"
log = "0.4.8"
exit-future = "0.2.0"
tokio-executor = { version = "0.2.0-alpha.6", features = ["blocking"] }
codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] }
availability_store = { package = "polkadot-availability-store", path = "../availability-store" }
parachain = { package = "polkadot-parachain", path = "../parachain" }
Expand Down
12 changes: 4 additions & 8 deletions validation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ enum CreateProposalState<C: Send + Sync, TxPool> {
/// Represents the state when we switch from pending to fired.
Switching,
/// Block proposing has fired.
Fired(tokio::task::JoinHandle<Result<Block, Error>>),
Fired(tokio_executor::blocking::Blocking<Result<Block, Error>>),
}

/// Inner data of the create proposal.
Expand Down Expand Up @@ -893,22 +893,18 @@ impl<C, TxPool> Future for CreateProposal<C, TxPool> where
thus Switching will never be reachable here; qed"
),
CreateProposalState::Fired(mut future) => {
let ret = Pin::new(&mut future)
.poll(cx)
.map(|res| res.map_err(Error::Join).and_then(|res| res));
let ret = Pin::new(&mut future).poll(cx);
self.state = CreateProposalState::Fired(future);
return ret
},
};

// 2. propose
let mut future = tokio::task::spawn_blocking(move || {
let mut future = tokio_executor::blocking::run(move || {
let proposed_candidates = data.table.proposed_set();
data.propose_with(proposed_candidates)
});
let polled = Pin::new(&mut future)
.poll(cx)
.map(|res| res.map_err(Error::Join).and_then(|res| res));
let polled = Pin::new(&mut future).poll(cx);
self.state = CreateProposalState::Fired(future);

polled
Expand Down

0 comments on commit 5e5a759

Please sign in to comment.