From 71899bf3438a71a9fcb235101a0f48451f8cc1bd Mon Sep 17 00:00:00 2001 From: Luca Palmieri Date: Wed, 2 Feb 2022 15:16:19 +0000 Subject: [PATCH] Update json/jsonrpc to v4 (#491) --- Cargo.lock | 6 +++--- json/jsonrpc/Cargo.toml | 8 ++++---- json/jsonrpc/src/main.rs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index def49a63..a51b1630 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3218,9 +3218,9 @@ dependencies = [ name = "jsonrpc-example" version = "1.0.0" dependencies = [ - "actix-web 3.3.3", - "bytes 0.5.6", - "env_logger 0.8.4", + "actix-web 4.0.0-beta.21", + "bytes 1.1.0", + "env_logger 0.9.0", "futures-util", "log", "serde 1.0.136", diff --git a/json/jsonrpc/Cargo.toml b/json/jsonrpc/Cargo.toml index 0c766e36..222a957c 100644 --- a/json/jsonrpc/Cargo.toml +++ b/json/jsonrpc/Cargo.toml @@ -4,11 +4,11 @@ version = "1.0.0" edition = "2021" [dependencies] -actix-web = "3" +actix-web = "4.0.0-beta.21" -bytes = "0.5" -env_logger = "0.8" +bytes = "1.1.0" +env_logger = "0.9.0" futures-util = "0.3" log = "0.4" serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +serde_json = "1.0.78" diff --git a/json/jsonrpc/src/main.rs b/json/jsonrpc/src/main.rs index 336c1dd2..d5477a7e 100644 --- a/json/jsonrpc/src/main.rs +++ b/json/jsonrpc/src/main.rs @@ -119,7 +119,7 @@ impl ImplNetwork for ObjNetwork { d: u64, ) -> Pin>>>> { async move { - actix_web::rt::time::delay_for(Duration::from_secs(d)).await; + actix_web::rt::time::sleep(Duration::from_secs(d)).await; Ok(String::from("pong")) } .boxed_local() @@ -155,7 +155,7 @@ async fn main() -> std::io::Result<()> { HttpServer::new(move || { let app_state = AppState::new(network.clone()); App::new() - .data(app_state) + .app_data(web::Data::new(app_state)) .wrap(middleware::Logger::default()) .service(web::resource("/").route(web::post().to(rpc_handler))) })