diff --git a/prismer/src/commands.rs b/prismer/src/commands.rs index 478ed63..ca5175b 100644 --- a/prismer/src/commands.rs +++ b/prismer/src/commands.rs @@ -147,7 +147,7 @@ impl Subscribe { let itv = env::var("INTERVAL") .ok() - .unwrap_or(String::from("12")) + .unwrap_or(String::from("15")) .parse::()?; let interval = Duration::from_secs(itv); info!("interval={:?}", interval); @@ -162,7 +162,7 @@ impl Subscribe { } else if let Ok(h) = db::load_last_height(&pool).await { h + 1 } else { - let prism_start = std::env::var("PRISM_START").unwrap_or(String::from("1")); + let prism_start = env::var("PRISM_START").unwrap_or("4004430".to_string()); prism_start.parse::().unwrap() }; @@ -192,7 +192,9 @@ impl Subscribe { Ok(_) => { info!("Block at {} loaded.", cursor); } - Err(Error::NotFound) => (), + Err(Error::NotFound) => { + error!("Block {} not found.", cursor); + } Err(e) => return Err(e), }; tokio::time::sleep(interval).await; diff --git a/prismer/src/rpc.rs b/prismer/src/rpc.rs index 58c6c73..3da1783 100644 --- a/prismer/src/rpc.rs +++ b/prismer/src/rpc.rs @@ -86,8 +86,13 @@ impl TendermintRPC { let resp = self.client.get(url).send().await?; let status = resp.status(); if !status.is_success() { - return Err(resp.text().await?.into()); + let resp_text = resp.text().await?; + if resp_text.contains("less than or equal to") { + return Err(Error::NotFound); + } + return Err(resp_text.into()); } + let bytes = resp.bytes().await?; if let Ok(r) = serde_json::from_slice::<'_, JsonRpcResponse>(&bytes) { Ok(r.result) diff --git a/scanner/src/commands.rs b/scanner/src/commands.rs index e647884..ae74603 100644 --- a/scanner/src/commands.rs +++ b/scanner/src/commands.rs @@ -166,7 +166,7 @@ impl Subscribe { let itv = env::var("INTERVAL") .ok() - .unwrap_or(String::from("12")) + .unwrap_or(String::from("15")) .parse::()?; let interval = Duration::from_secs(itv); info!("interval={:?}", interval); @@ -210,7 +210,9 @@ impl Subscribe { Ok(_) => { info!("Block at {} loaded.", cursor); } - Err(Error::NotFound) => (), + Err(Error::NotFound) => { + error!("Block {} not found.", cursor); + } Err(e) => return Err(e), }; tokio::time::sleep(interval).await; diff --git a/scanner/src/rpc.rs b/scanner/src/rpc.rs index f8d6e81..c671c86 100644 --- a/scanner/src/rpc.rs +++ b/scanner/src/rpc.rs @@ -132,8 +132,13 @@ impl TendermintRPC { let resp = self.client.get(url).send().await?; let status = resp.status(); if !status.is_success() { - return Err(resp.text().await?.into()); + let resp_text = resp.text().await?; + if resp_text.contains("less than or equal to") { + return Err(Error::NotFound); + } + return Err(resp_text.into()); } + let bytes = resp.bytes().await?; if let Ok(r) = serde_json::from_slice::<'_, JsonRpcResponse>(&bytes) { Ok(r.result)