chainhead backend: notify subscribers when the backend is closed (#1817)

* FollowEvent::stop include backend closed or not

* simplify code: enum variant BackendClosed

* check both stopped and backend closed

* simplify hacky code

* remove old test

* Update subxt/src/backend/chain_head/follow_stream_driver.rs

* Update subxt/src/backend/chain_head/mod.rs

* Update subxt/src/backend/chain_head/mod.rs

* Update subxt/src/backend/chain_head/follow_stream_driver.rs
This commit is contained in:
Niklas Adolfsson
2024-10-11 11:14:50 +02:00
committed by GitHub
parent 00b3149fca
commit 5bf1756394
4 changed files with 16 additions and 17 deletions
+2 -2
View File
@@ -308,7 +308,7 @@ impl<T: Config> ChainHeadRpcMethods<T> {
/// The following events are related to operations:
/// - OperationBodyDone: The response of the `chainHead_body`
/// - OperationCallDone: The response of the `chainHead_call`
/// - OperationStorageItems: Items produced by the `chianHead_storage`
/// - OperationStorageItems: Items produced by the `chainHead_storage`
/// - OperationWaitingForContinue: Generated after OperationStorageItems and requires the user to
/// call `chainHead_continue`
/// - OperationStorageDone: The `chainHead_storage` method has produced all the results
@@ -651,7 +651,7 @@ impl<Hash: BlockHash> Stream for FollowSubscription<Hash> {
if let Poll::Ready(Some(Ok(FollowEvent::Stop))) = &res {
// No more events will occur after this one.
self.done = true
self.done = true;
}
res