mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 00:57:57 +00:00
Fix state RPC subscriptions on light node (#3626)
* fetch all keys at once in light RPC subscriptions * restore lost fil
This commit is contained in:
committed by
Gavin Wood
parent
168051c060
commit
32e687abe4
@@ -74,13 +74,14 @@ impl Subscriptions {
|
||||
/// Second parameter is a function that converts Subscriber sink into a future.
|
||||
/// This future will be driven to completion by the underlying event loop
|
||||
/// or will be cancelled in case #cancel is invoked.
|
||||
pub fn add<T, E, G, R, F>(&self, subscriber: Subscriber<T, E>, into_future: G) where
|
||||
pub fn add<T, E, G, R, F>(&self, subscriber: Subscriber<T, E>, into_future: G) -> SubscriptionId where
|
||||
G: FnOnce(Sink<T, E>) -> R,
|
||||
R: future::IntoFuture<Future=F, Item=(), Error=()>,
|
||||
F: future::Future<Item=(), Error=()> + Send + 'static,
|
||||
{
|
||||
let id = self.next_id.next_id();
|
||||
if let Ok(sink) = subscriber.assign_id(id.into()) {
|
||||
let subscription_id: SubscriptionId = id.into();
|
||||
if let Ok(sink) = subscriber.assign_id(subscription_id.clone()) {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let future = into_future(sink)
|
||||
.into_future()
|
||||
@@ -92,6 +93,8 @@ impl Subscriptions {
|
||||
error!("Failed to spawn RPC subscription task");
|
||||
}
|
||||
}
|
||||
|
||||
subscription_id
|
||||
}
|
||||
|
||||
/// Cancel subscription.
|
||||
|
||||
Reference in New Issue
Block a user