Skip to content

Commit 16ed9f5

Browse files
ascjonestomusdrw
authored andcommitted
Fix tokio deprecation warnings (#358)
* Fix thread_pool::Builder deprecation * Fix reactor::Handle::current() deprecaction warning
1 parent 24b9bef commit 16ed9f5

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

http/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ fn serve<M: jsonrpc::Metadata, S: jsonrpc::Middleware<M>>(
459459
) {
460460
let (shutdown_signal, local_addr_tx) = signals;
461461
executor.spawn(future::lazy(move || {
462-
let handle = tokio::reactor::Handle::current();
462+
let handle = tokio::reactor::Handle::default();
463463

464464
let bind = move || {
465465
let listener = match addr {

server-utils/src/reactor.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,15 @@ impl RpcEventLoop {
107107
}
108108

109109
let handle = tb.spawn(move || {
110-
let mut tp_builder = tokio::executor::thread_pool::Builder::new();
111-
112-
let pool_size = match num_cpus::get_physical() {
110+
let core_threads = match num_cpus::get_physical() {
113111
1 => 1,
114112
2...4 => 2,
115113
_ => 3,
116114
};
117115

118-
tp_builder
119-
.pool_size(pool_size)
120-
.name_prefix("jsonrpc-eventloop-");
121-
122116
let runtime = tokio::runtime::Builder::new()
123-
.threadpool_builder(tp_builder)
117+
.core_threads(core_threads)
118+
.name_prefix("jsonrpc-eventloop-")
124119
.build();
125120

126121
match runtime {

0 commit comments

Comments
 (0)