Use ThreadPool::spawn_ok() instead of ThreadPool::spawn() (#3656)

* Bump futures-timer to v0.3

* Bump futures-preview to v0.3.0-alpha.18

* Replace ThreadPoll::spawn() with ThreadPoll::spawn_ok()
This commit is contained in:
Hernando Castano
2019-09-20 15:26:14 +02:00
committed by GitHub
parent c95fdd53d8
commit e434dbdfc5
21 changed files with 86 additions and 89 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2018"
[dependencies]
log = "0.4"
futures-preview = "=0.3.0-alpha.17"
futures-preview = "0.3.0-alpha.18"
codec = { package = "parity-scale-codec", version = "1.0.0" }
sr-primitives = { path = "../../core/sr-primitives" }
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
+1 -1
View File
@@ -18,7 +18,7 @@ lazy_static = "1.3"
app_dirs = "1.2"
tokio = "0.1.7"
futures = "0.1.17"
futures03 = { package = "futures-preview", version = "=0.3.0-alpha.17", features = ["compat"] }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
fdlimit = "0.1"
exit-future = "0.1"
serde_json = "1.0"
+1 -1
View File
@@ -11,7 +11,7 @@ log = { version = "0.4", optional = true }
parking_lot = { version = "0.9.0", optional = true }
hex = { package = "hex-literal", version = "0.2", optional = true }
futures = { version = "0.1", optional = true }
futures03 = { package = "futures-preview", version = "=0.3.0-alpha.17", features = ["compat"], optional = true }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"], optional = true }
consensus = { package = "substrate-consensus-common", path = "../consensus/common", optional = true }
executor = { package = "substrate-executor", path = "../executor", optional = true }
state-machine = { package = "substrate-state-machine", path = "../state-machine", optional = true }
+2 -2
View File
@@ -21,9 +21,9 @@ substrate-telemetry = { path = "../../telemetry" }
keystore = { package = "substrate-keystore", path = "../../keystore" }
consensus_common = { package = "substrate-consensus-common", path = "../common" }
sr-primitives = { path = "../../sr-primitives" }
futures-preview = { version = "=0.3.0-alpha.17", features = ["compat"] }
futures-preview = { version = "0.3.0-alpha.18", features = ["compat"] }
futures01 = { package = "futures", version = "0.1" }
futures-timer = "0.2.1"
futures-timer = "0.3"
parking_lot = "0.9.0"
log = "0.4"
+2 -2
View File
@@ -26,9 +26,9 @@ uncles = { package = "substrate-consensus-uncles", path = "../uncles" }
slots = { package = "substrate-consensus-slots", path = "../slots" }
sr-primitives = { path = "../../sr-primitives" }
fork-tree = { path = "../../utils/fork-tree" }
futures-preview = { version = "=0.3.0-alpha.17", features = ["compat"] }
futures-preview = { version = "0.3.0-alpha.18", features = ["compat"] }
futures01 = { package = "futures", version = "0.1" }
futures-timer = "0.2.1"
futures-timer = "0.3"
parking_lot = "0.9.0"
log = "0.4.6"
schnorrkel = { version = "0.8.4", features = ["preaudit_deprecated"] }
+2 -2
View File
@@ -11,8 +11,8 @@ libp2p = { version = "0.12.0", default-features = false }
log = "0.4"
primitives = { package = "substrate-primitives", path= "../../primitives" }
inherents = { package = "substrate-inherents", path = "../../inherents" }
futures-preview = "=0.3.0-alpha.17"
futures-timer = "0.2.1"
futures-preview = "0.3.0-alpha.18"
futures-timer = "0.3"
rstd = { package = "sr-std", path = "../../sr-std" }
runtime_version = { package = "sr-version", path = "../../sr-version" }
sr-primitives = { path = "../../sr-primitives" }
@@ -15,7 +15,7 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use std::{mem, pin::Pin, time::Duration};
use futures::{prelude::*, channel::mpsc, task::SpawnExt as _, task::Context, task::Poll};
use futures::{prelude::*, channel::mpsc, task::Context, task::Poll};
use futures_timer::Delay;
use sr_primitives::{Justification, traits::{Block as BlockT, Header as HeaderT, NumberFor}};
@@ -70,9 +70,7 @@ impl<B: BlockT> BasicQueue<B> {
let manual_poll;
if let Some(pool) = &mut pool {
// TODO: this expect() can be removed once
// https://github.com/rust-lang-nursery/futures-rs/pull/1750 is merged and deployed
pool.spawn(future).expect("ThreadPool can never fail to spawn tasks; QED");
pool.spawn_ok(future);
manual_poll = None;
} else {
manual_poll = Some(Box::pin(future) as Pin<Box<_>>);
+1 -1
View File
@@ -15,4 +15,4 @@ inherents = { package = "substrate-inherents", path = "../../inherents" }
pow-primitives = { package = "substrate-consensus-pow-primitives", path = "primitives" }
consensus-common = { package = "substrate-consensus-common", path = "../common" }
log = "0.4"
futures-preview = { version = "=0.3.0-alpha.17", features = ["compat"] }
futures-preview = { version = "0.3.0-alpha.18", features = ["compat"] }
+2 -2
View File
@@ -14,8 +14,8 @@ sr-primitives = { path = "../../sr-primitives" }
substrate-telemetry = { path = "../../telemetry" }
consensus_common = { package = "substrate-consensus-common", path = "../common" }
inherents = { package = "substrate-inherents", path = "../../inherents" }
futures-preview = "=0.3.0-alpha.17"
futures-timer = "0.2.1"
futures-preview = "0.3.0-alpha.18"
futures-timer = "0.3"
parking_lot = "0.9.0"
log = "0.4"
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
fork-tree = { path = "../../core/utils/fork-tree" }
futures = "0.1"
futures03 = { package = "futures-preview", version = "=0.3.0-alpha.17", features = ["compat"] }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
log = "0.4"
parking_lot = "0.9.0"
tokio-executor = "0.1.7"
+2 -2
View File
@@ -15,8 +15,8 @@ parking_lot = "0.9.0"
bitflags = "1.0"
fnv = "1.0"
futures = "0.1.17"
futures03 = { package = "futures-preview", version = "=0.3.0-alpha.17", features = ["compat"] }
futures-timer = "0.2.1"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
futures-timer = "0.3"
linked-hash-map = "0.5"
linked_hash_set = "0.1.3"
lru-cache = "0.1.1"
+2 -2
View File
@@ -11,8 +11,8 @@ bytes = "0.4"
client = { package = "substrate-client", path = "../../core/client" }
fnv = "1.0"
futures01 = { package = "futures", version = "0.1" }
futures-preview = "=0.3.0-alpha.17"
futures-timer = "0.2.1"
futures-preview = "0.3.0-alpha.18"
futures-timer = "0.3"
hyper = "0.12.33"
hyper-tls = "0.3.2"
log = "0.4"
+1 -1
View File
@@ -8,7 +8,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
futures-preview = "=0.3.0-alpha.17"
futures-preview = "0.3.0-alpha.18"
libp2p = { version = "0.12.0", default-features = false }
linked-hash-map = "0.5"
log = "0.4"
+1 -1
View File
@@ -8,7 +8,7 @@ edition = "2018"
api = { package = "substrate-rpc-api", path = "./api" }
client = { package = "substrate-client", path = "../client" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.17", features = ["compat"] }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
jsonrpc-pubsub = "13.1.0"
log = "0.4"
primitives = { package = "substrate-primitives", path = "../primitives" }
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.0.0" }
derive_more = "0.14.0"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.17", features = ["compat"] }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
jsonrpc-core = "13.2.0"
jsonrpc-core-client = "13.2.0"
jsonrpc-derive = "13.2.0"
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
derive_more = "0.14.0"
futures = "0.1.17"
futures03 = { package = "futures-preview", version = "=0.3.0-alpha.17", features = ["compat"] }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
parking_lot = "0.9.0"
lazy_static = "1.0"
log = "0.4"
+2 -2
View File
@@ -9,8 +9,8 @@ edition = "2018"
bytes = "0.4"
parking_lot = "0.9.0"
futures01 = { package = "futures", version = "0.1" }
futures-preview = { version = "=0.3.0-alpha.17", features = ["compat"] }
futures-timer = "0.2.1"
futures-preview = { version = "0.3.0-alpha.18", features = ["compat"] }
futures-timer = "0.3"
libp2p = { version = "0.12.0", default-features = false, features = ["libp2p-websocket"] }
log = "0.4"
rand = "0.6"
+1 -1
View File
@@ -9,7 +9,7 @@ client = { package = "substrate-client", path = "../client" }
client-db = { package = "substrate-client-db", path = "../client/db", features = ["test-helpers"] }
consensus = { package = "substrate-consensus-common", path = "../consensus/common" }
executor = { package = "substrate-executor", path = "../executor" }
futures-preview = "=0.3.0-alpha.17"
futures-preview = "0.3.0-alpha.18"
hash-db = "0.15.2"
keyring = { package = "substrate-keyring", path = "../keyring" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
@@ -6,7 +6,7 @@ edition = "2018"
[dependencies]
derive_more = "0.14.0"
futures-preview = "=0.3.0-alpha.17"
futures-preview = "0.3.0-alpha.18"
log = "0.4"
parking_lot = "0.9.0"
serde = { version = "1.0", features = ["derive"] }