Skip to content
Draft
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

* Fix `StatusCode::SERVICE_UNAVAILABLE` in `ic-agent`.
* Time out `Unknown` statuses after 5 minutes, regardless of the configured `max_polling_time`.

### Breaking Changes
Expand Down
9 changes: 6 additions & 3 deletions ic-agent/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Agent {
/// Create an instance of an [`Agent`].
pub fn new(config: agent_config::AgentConfig) -> Result<Agent, AgentError> {
let client = config.http_service.unwrap_or_else(|| {
Arc::new(Retry429Logic {
Arc::new(RetryLogic {
client: config.client.unwrap_or_else(|| {
#[cfg(not(target_family = "wasm"))]
{
Expand Down Expand Up @@ -2237,13 +2237,13 @@ where
}

#[derive(Debug)]
struct Retry429Logic {
struct RetryLogic {
client: Client,
}

#[cfg_attr(target_family = "wasm", async_trait(?Send))]
#[cfg_attr(not(target_family = "wasm"), async_trait)]
impl HttpService for Retry429Logic {
impl HttpService for RetryLogic {
async fn call<'a>(
&'a self,
req: &'a (dyn Fn() -> Result<http::Request<Bytes>, AgentError> + Send + Sync),
Expand Down Expand Up @@ -2275,6 +2275,9 @@ impl HttpService for Retry429Logic {
crate::util::sleep(Duration::from_millis(250)).await;
continue;
}
} else if resp.status() == StatusCode::SERVICE_UNAVAILABLE {
crate::util::sleep(Duration::from_millis(250)).await;
continue;
} else {
break Ok(resp);
}
Expand Down
Loading