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:
Svyatoslav Nikolsky
2019-10-07 09:00:15 +03:00
committed by Gavin Wood
parent 168051c060
commit 32e687abe4
6 changed files with 714 additions and 207 deletions
+5 -2
View File
@@ -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.