Skip to content

Commit

Permalink
Merge pull request #20 from RelationalAI/ag-extra-retries-log
Browse files Browse the repository at this point in the history
Add extra retry to error log
  • Loading branch information
andrebsguedes committed Apr 4, 2024
2 parents ad20145 + 3944c91 commit c8d365d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "object_store_ffi"
version = "0.6.0"
version = "0.6.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,20 @@ macro_rules! with_retries_and_cancellation {
return;
}
Err(e) => {
let reason = extract_error_info(&e).reason;
if let Some(duration) = should_retry(retries, &e, start_instant.elapsed(), $config).await {
retries += 1;
tracing::info!("retrying error (reason: {:?}) after {:?}: {}", extract_error_info(&e).reason, duration, e);
tracing::info!("retrying error (reason: {:?}) after {:?}: {}", reason, duration, e);
tokio::time::sleep(duration).await;
continue 'retry;
}
tracing::warn!("{}", e);
$response.into_error(e);
let error_message = if retries > 0 {
format!("{} (after {} extra retries, reason: {:?})", e, retries, reason)
} else {
format!("{}", e)
};
tracing::warn!("{}", error_message);
$response.into_error(error_message);
return;
}
}
Expand Down

0 comments on commit c8d365d

Please sign in to comment.