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
+1 -9
View File
@@ -893,15 +893,7 @@ mod test {
}
fn build_backend_spawn_background(rpc_client: impl RpcClientT) -> ChainHeadBackend<Conf> {
let (backend, mut driver) = build_backend(rpc_client);
tokio::spawn(async move {
while let Some(val) = driver.next().await {
if let Err(e) = val {
eprintln!("Error driving unstable backend: {e}; terminating client");
}
}
});
backend
ChainHeadBackend::builder().build_with_background_driver(rpc_client)
}
fn runtime_spec() -> RuntimeSpec {