Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

add_sync_notifier in EthPubSubClient holds on to a Client for too long #10689

Merged
merged 1 commit into from
May 23, 2019
Merged
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
8 changes: 5 additions & 3 deletions rpc/src/v1/impls/eth_pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ impl<C> EthPubSubClient<C>
where
F: 'static + Fn(SyncState) -> Option<pubsub::PubSubSyncStatus> + Send
{
let handler = self.handler.clone();
let weak_handler = Arc::downgrade(&self.handler);

self.handler.executor.spawn(
receiver.for_each(move |state| {
if let Some(status) = f(state) {
handler.notify_syncing(status);
return Ok(())
if let Some(handler) = weak_handler.upgrade() {
handler.notify_syncing(status);
return Ok(())
}
}
Err(())
})
Expand Down