Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable2409] Backport #6454 #6654

Open
wants to merge 1 commit into
base: stable2409
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions prdoc/pr_6588.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: "rpc server: fix subscription id_provider being reset to default one"

doc:
- audience: Node Dev
description: |
The modification ensures that the id_provider variable is cloned instead of taken, which can help prevent issues related id provider being reset to the default.


crates:
- name: sc-rpc-server
bump: patch
7 changes: 3 additions & 4 deletions substrate/client/rpc-servers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ where
local_addrs.push(local_addr);
let cfg = cfg.clone();

let mut id_provider2 = id_provider.clone();
let id_provider2 = id_provider.clone();

tokio_handle.spawn(async move {
loop {
Expand Down Expand Up @@ -166,10 +166,9 @@ where
.set_http_middleware(http_middleware)
.set_message_buffer_capacity(max_buffer_capacity_per_connection)
.set_batch_request_config(batch_config)
.custom_tokio_runtime(cfg.tokio_handle.clone())
.set_id_provider(RandomStringIdProvider::new(16));
.custom_tokio_runtime(cfg.tokio_handle.clone());

if let Some(provider) = id_provider2.take() {
if let Some(provider) = id_provider2.clone() {
builder = builder.set_id_provider(provider);
} else {
builder = builder.set_id_provider(RandomStringIdProvider::new(16));
Expand Down
Loading