Upgrade actix to v4.0.0-beta.4 (and associated fall-out)

This commit is contained in:
David Palm
2021-03-25 17:13:25 +01:00
parent dbabc88127
commit 3978085a38
6 changed files with 429 additions and 1315 deletions
+404 -1287
View File
File diff suppressed because it is too large Load Diff
+7 -10
View File
@@ -6,21 +6,21 @@ edition = "2018"
license = "GPL-3.0" license = "GPL-3.0"
[dependencies] [dependencies]
actix = "0.10.0" actix = "0.11.1"
actix-web = "3.1.0" actix-web = "4.0.0-beta.4"
actix-web-actors = "3.0.0" actix-web-actors = "4.0.0-beta.3"
actix-http = "2.0.0" actix-http = "3.0.0-beta.4"
bytes = "0.5.6" bytes = "1.0.1"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
fnv = "1.0.7" fnv = "1.0.7"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["raw_value"] } serde_json = { version = "1.0", features = ["raw_value"] }
primitive-types = { version = "0.7.2", features = ["serde"] } primitive-types = { version = "0.9.0", features = ["serde"] }
log = "0.4" log = "0.4"
simple_logger = "1.11.0" simple_logger = "1.11.0"
num-traits = "0.2" num-traits = "0.2"
parking_lot = "0.11" parking_lot = "0.11"
reqwest = "0.9.18" reqwest = { version = "0.11.1", features = ["blocking", "json"] }
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
clap = "3.0.0-beta.2" clap = "3.0.0-beta.2"
lazy_static = "1" lazy_static = "1"
@@ -28,6 +28,3 @@ lazy_static = "1"
[profile.release] [profile.release]
lto = true lto = true
panic = "abort" panic = "abort"
[patch.crates-io]
actix-web = { git = "https://github.com/maciejhirsz/actix-web", branch = "no-panic-normalize" }
+5 -5
View File
@@ -67,7 +67,7 @@ impl From<&LogLevel> for log::LevelFilter {
} }
/// Entry point for connecting nodes /// Entry point for connecting nodes
#[get("/submit/")] #[get("/submit")]
async fn node_route( async fn node_route(
req: HttpRequest, req: HttpRequest,
stream: web::Payload, stream: web::Payload,
@@ -93,7 +93,7 @@ async fn node_route(
} }
/// Entry point for connecting feeds /// Entry point for connecting feeds
#[get("/feed/")] #[get("/feed")]
async fn feed_route( async fn feed_route(
req: HttpRequest, req: HttpRequest,
stream: web::Payload, stream: web::Payload,
@@ -107,7 +107,7 @@ async fn feed_route(
} }
/// Entry point for network state dump /// Entry point for network state dump
#[get("/network_state/{chain}/{nid}/")] #[get("/network_state/{chain}/{nid}")]
async fn state_route( async fn state_route(
path: web::Path<(Box<str>, NodeId)>, path: web::Path<(Box<str>, NodeId)>,
aggregator: web::Data<Addr<Aggregator>>, aggregator: web::Data<Addr<Aggregator>>,
@@ -136,7 +136,7 @@ async fn state_route(
} }
/// Entry point for health check monitoring bots /// Entry point for health check monitoring bots
#[get("/health/")] #[get("/health")]
async fn health(aggregator: web::Data<Addr<Aggregator>>) -> Result<HttpResponse, Error> { async fn health(aggregator: web::Data<Addr<Aggregator>>) -> Result<HttpResponse, Error> {
match aggregator.send(GetHealth).await { match aggregator.send(GetHealth).await {
Ok(count) => { Ok(count) => {
@@ -174,7 +174,7 @@ async fn main() -> std::io::Result<()> {
.service(state_route) .service(state_route)
.service(health) .service(health)
}) })
.bind(format!("{}", opts.socket))? .bind(opts.socket)?
.run() .run()
.await .await
} }
+1 -1
View File
@@ -196,7 +196,7 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for NodeConnector {
return; return;
} }
Ok(ws::Message::Pong(_)) => return, Ok(ws::Message::Pong(_)) => return,
Ok(ws::Message::Text(text)) => text.into(), Ok(ws::Message::Text(text)) => text.into_bytes(),
Ok(ws::Message::Binary(data)) => data, Ok(ws::Message::Binary(data)) => data,
Ok(ws::Message::Close(_)) => { Ok(ws::Message::Close(_)) => {
ctx.stop(); ctx.stop();
+2 -2
View File
@@ -11,7 +11,7 @@ use crate::types::{NodeId, NodeLocation};
#[derive(Clone)] #[derive(Clone)]
pub struct Locator { pub struct Locator {
client: reqwest::Client, client: reqwest::blocking::Client,
cache: Arc<RwLock<FxHashMap<Ipv4Addr, Option<Arc<NodeLocation>>>>>, cache: Arc<RwLock<FxHashMap<Ipv4Addr, Option<Arc<NodeLocation>>>>>,
} }
@@ -36,7 +36,7 @@ impl LocatorFactory {
pub fn create(&self) -> Locator { pub fn create(&self) -> Locator {
Locator { Locator {
client: reqwest::Client::new(), client: reqwest::blocking::Client::new(),
cache: self.cache.clone(), cache: self.cache.clone(),
} }
} }
+10 -10
View File
@@ -39,19 +39,19 @@ export class Connection {
private static readonly address = Connection.getAddress(); private static readonly address = Connection.getAddress();
private static getAddress(): string { private static getAddress(): string {
const ENV_URL = 'SUBSTRATE_TELEMETRY_URL'; // const ENV_URL = 'SUBSTRATE_TELEMETRY_URL';
if (process.env && process.env[ENV_URL]) { // if (process.env && process.env[ENV_URL]) {
return process.env[ENV_URL] as string; // return process.env[ENV_URL] as string;
} // }
if (window.process_env && window.process_env[ENV_URL]) { // if (window.process_env && window.process_env[ENV_URL]) {
return window.process_env[ENV_URL]; // return window.process_env[ENV_URL];
} // }
if (window.location.protocol === 'https:') { // if (window.location.protocol === 'https:') {
return `wss://${window.location.hostname}/feed/`; // return `wss://${window.location.hostname}/feed/`;
} // }
return `ws://127.0.0.1:8000/feed`; return `ws://127.0.0.1:8000/feed`;
} }