mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-01-13 08:35:59 +00:00
add retry (#232)
This commit is contained in:
parent
3fc1543fb4
commit
a4b02a21b7
@ -662,6 +662,7 @@ async fn check_watch_process(
|
|||||||
"get block hash for block {} from RPC, assume there is no org",
|
"get block hash for block {} from RPC, assume there is no org",
|
||||||
*progress - 1
|
*progress - 1
|
||||||
);
|
);
|
||||||
|
let hash = loop {
|
||||||
match provider.get_block(*progress - 1).await {
|
match provider.get_block(*progress - 1).await {
|
||||||
Ok(Some(v)) => {
|
Ok(Some(v)) => {
|
||||||
break v.hash.expect("parent block hash expect exist");
|
break v.hash.expect("parent block hash expect exist");
|
||||||
@ -670,11 +671,17 @@ async fn check_watch_process(
|
|||||||
panic!("parent block {} expect exist", *progress - 1);
|
panic!("parent block {} expect exist", *progress - 1);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
if e.to_string().contains("server is too busy") {
|
||||||
|
warn!("server busy, wait for parent block {}", *progress - 1);
|
||||||
|
} else {
|
||||||
panic!("parent block {} expect exist, error {}", *progress - 1, e);
|
panic!("parent block {} expect exist, error {}", *progress - 1, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
break hash;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
progress_reset_history.retain(|k, _| k + 1000 >= *progress);
|
progress_reset_history.retain(|k, _| k + 1000 >= *progress);
|
||||||
|
Loading…
Reference in New Issue
Block a user