diff --git a/impls/src/client_utils/client.rs b/impls/src/client_utils/client.rs
index 4cf915a4..294f9711 100644
--- a/impls/src/client_utils/client.rs
+++ b/impls/src/client_utils/client.rs
@@ -31,7 +31,7 @@ use serde_json;
use std::fmt::{self, Display};
use std::net::SocketAddr;
use std::time::Duration;
-use tokio::runtime::Runtime;
+use tokio::runtime::Builder;
/// Errors that can be returned by an ApiEndpoint implementation.
#[derive(Debug)]
@@ -389,8 +389,12 @@ impl Client {
pub fn send_request(&self, req: Request
) -> Result {
let task = self.send_request_async(req);
- let mut rt =
- Runtime::new().context(ErrorKind::Internal("can't create Tokio runtime".to_owned()))?;
- Ok(rt.block_on(task)?)
+ let mut rt = Builder::new()
+ .core_threads(1)
+ .build()
+ .context(ErrorKind::Internal("can't create Tokio runtime".to_owned()))?;
+ let res = rt.block_on(task);
+ let _ = rt.shutdown_now().wait();
+ res
}
}
diff --git a/impls/src/node_clients/http.rs b/impls/src/node_clients/http.rs
index 8bfcfde1..8c1edea5 100644
--- a/impls/src/node_clients/http.rs
+++ b/impls/src/node_clients/http.rs
@@ -17,10 +17,10 @@
use crate::api::{self, LocatedTxKernel, OutputListing, OutputPrintable};
use crate::core::core::{Transaction, TxKernel};
use crate::libwallet::{NodeClient, NodeVersionInfo};
-use futures::{stream, Stream};
+use futures::{stream, Future, Stream};
use std::collections::HashMap;
use std::env;
-use tokio::runtime::Runtime;
+use tokio::runtime::Builder;
use crate::client_utils::Client;
use crate::libwallet;
@@ -237,8 +237,10 @@ impl NodeClient for HTTPNodeClient {
}
let task = stream::futures_unordered(tasks).collect();
- let mut rt = Runtime::new().unwrap();
- let results: Vec = match rt.block_on(task) {
+ let mut rt = Builder::new().core_threads(1).build().unwrap();
+ let res = rt.block_on(task);
+ let _ = rt.shutdown_now().wait();
+ let results: Vec = match res {
Ok(resps) => {
let mut results = vec![];
for r in resps {