From f2c9c5173d22cef009e7f67a82a0c31ac44f5426 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 17 May 2022 23:12:59 +0300 Subject: [PATCH] Remove unnecessary RPC boxing (#11434) --- client/beefy/rpc/src/lib.rs | 6 ++---- client/finality-grandpa/rpc/src/lib.rs | 6 ++---- client/rpc/src/author/mod.rs | 6 ++---- client/rpc/src/chain/chain_full.rs | 5 ++--- client/rpc/src/state/state_full.rs | 12 ++++-------- 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/client/beefy/rpc/src/lib.rs b/client/beefy/rpc/src/lib.rs index e4c8c76419ccb..ea35678a48b8f 100644 --- a/client/beefy/rpc/src/lib.rs +++ b/client/beefy/rpc/src/lib.rs @@ -146,11 +146,9 @@ where if let Some(mut sink) = pending.accept() { sink.pipe_from_stream(stream).await; } - } - .boxed(); + }; - self.executor - .spawn("substrate-rpc-subscription", Some("rpc"), fut.map(drop).boxed()); + self.executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed()); } async fn latest_finalized(&self) -> RpcResult { diff --git a/client/finality-grandpa/rpc/src/lib.rs b/client/finality-grandpa/rpc/src/lib.rs index 82962d716d589..cb51d71b20bf4 100644 --- a/client/finality-grandpa/rpc/src/lib.rs +++ b/client/finality-grandpa/rpc/src/lib.rs @@ -113,11 +113,9 @@ where if let Some(mut sink) = pending.accept() { sink.pipe_from_stream(stream).await; } - } - .boxed(); + }; - self.executor - .spawn("substrate-rpc-subscription", Some("rpc"), fut.map(drop).boxed()); + self.executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed()); } async fn prove_finality( diff --git a/client/rpc/src/author/mod.rs b/client/rpc/src/author/mod.rs index d10398afc813b..b8c4f5d582808 100644 --- a/client/rpc/src/author/mod.rs +++ b/client/rpc/src/author/mod.rs @@ -210,10 +210,8 @@ where }; sink.pipe_from_stream(stream).await; - } - .boxed(); + }; - self.executor - .spawn("substrate-rpc-subscription", Some("rpc"), fut.map(drop).boxed()); + self.executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed()); } } diff --git a/client/rpc/src/chain/chain_full.rs b/client/rpc/src/chain/chain_full.rs index 9ca6b3edcfe60..2d507f7b9b684 100644 --- a/client/rpc/src/chain/chain_full.rs +++ b/client/rpc/src/chain/chain_full.rs @@ -147,8 +147,7 @@ fn subscribe_headers( if let Some(mut sink) = pending.accept() { sink.pipe_from_stream(stream).await; } - } - .boxed(); + }; - executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.map(drop).boxed()); + executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed()); } diff --git a/client/rpc/src/state/state_full.rs b/client/rpc/src/state/state_full.rs index 48165e912b03a..0e20832b30508 100644 --- a/client/rpc/src/state/state_full.rs +++ b/client/rpc/src/state/state_full.rs @@ -404,11 +404,9 @@ where if let Some(mut sink) = pending.accept() { sink.pipe_from_stream(stream).await; } - } - .boxed(); + }; - self.executor - .spawn("substrate-rpc-subscription", Some("rpc"), fut.map(drop).boxed()); + self.executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed()); } fn subscribe_storage(&self, pending: PendingSubscription, keys: Option>) { @@ -451,11 +449,9 @@ where if let Some(mut sink) = pending.accept() { sink.pipe_from_stream(stream).await; } - } - .boxed(); + }; - self.executor - .spawn("substrate-rpc-subscription", Some("rpc"), fut.map(drop).boxed()); + self.executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed()); } async fn trace_block(