Skip to content

Commit 6ff15dd

Browse files
authored
fix(sdk): retry network client creation failures (#2174)
1 parent f2a6187 commit 6ff15dd

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

crates/sdk/src/network/client.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,25 @@ impl NetworkClient {
339339
}
340340

341341
pub(crate) async fn prover_network_client(&self) -> Result<ProverNetworkClient<Channel>> {
342-
let channel = grpc::configure_endpoint(&self.rpc_url)?.connect().await?;
343-
Ok(ProverNetworkClient::new(channel))
342+
self.with_retry(
343+
|| async {
344+
let channel = grpc::configure_endpoint(&self.rpc_url)?.connect().await?;
345+
Ok(ProverNetworkClient::new(channel))
346+
},
347+
"creating network client",
348+
)
349+
.await
344350
}
345351

346352
pub(crate) async fn artifact_store_client(&self) -> Result<ArtifactStoreClient<Channel>> {
347-
let channel = grpc::configure_endpoint(&self.rpc_url)?.connect().await?;
348-
Ok(ArtifactStoreClient::new(channel))
353+
self.with_retry(
354+
|| async {
355+
let channel = grpc::configure_endpoint(&self.rpc_url)?.connect().await?;
356+
Ok(ArtifactStoreClient::new(channel))
357+
},
358+
"creating artifact client",
359+
)
360+
.await
349361
}
350362

351363
pub(crate) async fn create_artifact_with_content<T: Serialize + Send + Sync>(

0 commit comments

Comments
 (0)