mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 20:17:57 +00:00
Upgrade jsonrpc to 0.18.0 (#9547)
* Upgrade jsonrpc to 0.18.0
I think this says all :P
* 🤦
* Fmt etc
* Fix tests
* Fix tests again...
* Better impl
* Revert "Tell dependabot to ignore jsonrpc-* updates (#9518)"
This reverts commit 6e0cd5587d.
This commit is contained in:
@@ -61,10 +61,13 @@ pub fn rpc_handler<M: PubSubMetadata>(
|
||||
.expect("Serialization of Vec<String> is infallible; qed");
|
||||
|
||||
move |_| {
|
||||
Ok(serde_json::json!({
|
||||
"version": 1,
|
||||
"methods": methods.clone(),
|
||||
}))
|
||||
let methods = methods.clone();
|
||||
async move {
|
||||
Ok(serde_json::json!({
|
||||
"version": 1,
|
||||
"methods": methods,
|
||||
}))
|
||||
}
|
||||
}
|
||||
});
|
||||
io
|
||||
@@ -84,7 +87,7 @@ mod inner {
|
||||
/// Start HTTP server listening on given address.
|
||||
///
|
||||
/// **Note**: Only available if `not(target_os = "unknown")`.
|
||||
pub fn start_http<M: pubsub::PubSubMetadata + Default>(
|
||||
pub fn start_http<M: pubsub::PubSubMetadata + Default + Unpin>(
|
||||
addr: &std::net::SocketAddr,
|
||||
thread_pool_size: Option<usize>,
|
||||
cors: Option<&Vec<String>>,
|
||||
@@ -94,6 +97,7 @@ mod inner {
|
||||
let max_request_body_size = maybe_max_payload_mb
|
||||
.map(|mb| mb.saturating_mul(MEGABYTE))
|
||||
.unwrap_or(RPC_MAX_PAYLOAD_DEFAULT);
|
||||
|
||||
http::ServerBuilder::new(io)
|
||||
.threads(thread_pool_size.unwrap_or(HTTP_THREADS))
|
||||
.health_api(("/health", "system_health"))
|
||||
@@ -125,7 +129,7 @@ mod inner {
|
||||
///
|
||||
/// **Note**: Only available if `not(target_os = "unknown")`.
|
||||
pub fn start_ws<
|
||||
M: pubsub::PubSubMetadata + From<jsonrpc_core::futures::sync::mpsc::Sender<String>>,
|
||||
M: pubsub::PubSubMetadata + From<futures::channel::mpsc::UnboundedSender<String>>,
|
||||
>(
|
||||
addr: &std::net::SocketAddr,
|
||||
max_connections: Option<usize>,
|
||||
|
||||
@@ -73,12 +73,12 @@ impl<M: Metadata> RequestMiddleware<M> for RpcMiddleware {
|
||||
fn on_request<F, X>(&self, request: Request, meta: M, next: F) -> Either<FutureResponse, X>
|
||||
where
|
||||
F: Fn(Request, M) -> X + Send + Sync,
|
||||
X: Future<Item = Option<Response>, Error = ()> + Send + 'static,
|
||||
X: Future<Output = Option<Response>> + Send + 'static,
|
||||
{
|
||||
if let Some(ref rpc_calls) = self.metrics.rpc_calls {
|
||||
rpc_calls.with_label_values(&[self.transport_label.as_str()]).inc();
|
||||
}
|
||||
|
||||
Either::B(next(request, meta))
|
||||
Either::Right(next(request, meta))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user