Skip to content

Add nice warnings for re-try mechanisms #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions hypersync-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,14 @@ impl Client {

let mut err = anyhow!("");

for _ in 0..self.max_num_retries + 1 {
for i in 0..self.max_num_retries + 1 {
match self.get_chain_id_impl().await {
Ok(res) => return Ok(res),
Err(e) => {
log::error!(
"failed to get chain_id from server, retrying... The error was: {:?}",
log::warn!(
"An exception occured getting chain_id from server. Retrying request ({}/{}). The error was: {:?}",
i - 1 ,
self.max_num_retries,
e
);
err = err.context(format!("{:?}", e));
Expand All @@ -333,12 +335,14 @@ impl Client {

let mut err = anyhow!("");

for _ in 0..self.max_num_retries + 1 {
for i in 0..self.max_num_retries + 1 {
match self.get_height_impl(None).await {
Ok(res) => return Ok(res),
Err(e) => {
log::error!(
"failed to get height from server, retrying... The error was: {:?}",
log::warn!(
"An exception occured getting height from server. Retrying request ({}/{}). The error was: {:?}",
i,
self.max_num_retries,
e
);
err = err.context(format!("{:?}", e));
Expand Down Expand Up @@ -425,12 +429,14 @@ impl Client {

let mut err = anyhow!("");

for _ in 0..self.max_num_retries + 1 {
for i in 0..self.max_num_retries + 1 {
match self.get_arrow_impl(query).await {
Ok(res) => return Ok(res),
Err(e) => {
log::error!(
"failed to get arrow data from server, retrying... The error was: {:?}",
log::warn!(
"An exception occured getting arrow data from server. Retrying request ({}/{}). The error was: {:?}",
i - 1 ,
self.max_num_retries,
e
);
err = err.context(format!("{:?}", e));
Expand Down
Loading