From 02bd1a2b17cf2590746d31c6d2aa9fe1c003d7db Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Tue, 12 Dec 2023 16:36:33 +0200 Subject: [PATCH] backend: Memory log after 120s timeout Signed-off-by: Alexandru Vasile --- subxt/src/backend/unstable/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subxt/src/backend/unstable/mod.rs b/subxt/src/backend/unstable/mod.rs index fb1437352d..4ba25afc86 100644 --- a/subxt/src/backend/unstable/mod.rs +++ b/subxt/src/backend/unstable/mod.rs @@ -474,9 +474,17 @@ impl Backend for UnstableBackend { // with chainHead_follow. let mut finalized_hash: Option = None; + let now = std::time::Instant::now(); + let mut mem_log = vec![]; + // Now we can attempt to associate tx events with pinned blocks. let tx_stream = futures::stream::poll_fn(move |cx| { loop { + if now.elapsed().as_secs() > 120 { + println!("Log stream: {:?}", mem_log); + panic!("{:?}", mem_log); + } + // Bail early if no more tx events; we don't want to keep polling for pinned blocks. if done { return Poll::Ready(None); @@ -535,6 +543,8 @@ impl Backend for UnstableBackend { Poll::Ready(Some(Ok(ev))) => ev, }; + mem_log.push((now.elapsed(), ev.clone())); + // When we get one, map it to the correct format (or for finalized ev, wait for the pinned block): let ev = match ev { rpc_methods::TransactionStatus::Finalized { block } => {