Use bounded channels for network -> sync -> import (#1874)

* use bounded channels for network -> sync -> import

* bound at 4

* indent

* use return value of handle_network_msg
This commit is contained in:
Gregory Terzian
2019-02-27 16:19:57 +08:00
committed by Gav Wood
parent 64685c0536
commit 5282615416
4 changed files with 100 additions and 61 deletions
@@ -263,7 +263,7 @@ impl<B: BlockT> BlockImporter<B> {
worker_sender: Sender<BlockImportWorkerMsg<B>>,
justification_import: Option<SharedJustificationImport<B>>,
) -> Sender<BlockImportMsg<B>> {
let (sender, port) = channel::unbounded();
let (sender, port) = channel::bounded(4);
let _ = thread::Builder::new()
.name("ImportQueue".into())
.spawn(move || {
@@ -454,7 +454,7 @@ impl<B: BlockT, V: 'static + Verifier<B>> BlockImportWorker<B, V> {
verifier: Arc<V>,
block_import: SharedBlockImport<B>,
) -> Sender<BlockImportWorkerMsg<B>> {
let (sender, port) = channel::unbounded();
let (sender, port) = channel::bounded(4);
let _ = thread::Builder::new()
.name("ImportQueueWorker".into())
.spawn(move || {