tweak test node online condition

This commit is contained in:
Giacomo Pasini 2023-10-24 16:43:11 +02:00
parent acd69b2f09
commit 0fc2380ea5
No known key found for this signature in database
GPG Key ID: FC08489D2D895D4B
1 changed files with 5 additions and 2 deletions

View File

@ -99,7 +99,11 @@ impl NomosNode {
} }
async fn wait_online(&self) { async fn wait_online(&self) {
while self.get(CARNOT_INFO_API).await.is_err() { loop {
let res = self.get(CARNOT_INFO_API).await;
if res.is_ok() && res.unwrap().status().is_success() {
break;
}
tokio::time::sleep(Duration::from_millis(100)).await; tokio::time::sleep(Duration::from_millis(100)).await;
} }
} }
@ -201,7 +205,6 @@ impl Node for NomosNode {
async fn consensus_info(&self) -> Self::ConsensusInfo { async fn consensus_info(&self) -> Self::ConsensusInfo {
let res = self.get(CARNOT_INFO_API).await; let res = self.get(CARNOT_INFO_API).await;
println!("res: {:?}", res);
res.unwrap().json().await.unwrap() res.unwrap().json().await.unwrap()
} }