backend: Add loop iteration debug and panic

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2024-01-15 13:33:58 +02:00
parent 641a45f911
commit 9d3bc1830c
2 changed files with 12 additions and 4 deletions
Generated
+4 -4
View File
@@ -2015,7 +2015,7 @@ dependencies = [
"http",
"hyper",
"log",
"rustls 0.21.9",
"rustls 0.21.10",
"rustls-native-certs 0.6.3",
"tokio",
"tokio-rustls 0.24.1",
@@ -2264,7 +2264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "776d009e2f591b78c038e0d053a796f94575d66ca4e77dd84bfc5e81419e436c"
dependencies = [
"anyhow",
"async-lock 3.2.0",
"async-lock 3.3.0",
"async-trait",
"beef",
"futures-timer",
@@ -3289,7 +3289,7 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4"
dependencies = [
"base64 0.21.5",
"base64 0.21.6",
"rustls-pki-types",
]
@@ -4665,7 +4665,7 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
"rustls 0.21.9",
"rustls 0.21.10",
"tokio",
]
+8
View File
@@ -474,9 +474,17 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for UnstableBackend<T> {
// with chainHead_follow.
let mut finalized_hash: Option<T::Hash> = None;
let mut iter_num = 0;
let now = std::time::Instant::now();
// Now we can attempt to associate tx events with pinned blocks.
let tx_stream = futures::stream::poll_fn(move |cx| {
loop {
iter_num += 1;
if now.elapsed().as_secs() > 120 {
panic!("iter={:#?}", iter_num);
}
// Bail early if no more tx events; we don't want to keep polling for pinned blocks.
if done {
return Poll::Ready(None);