Skip to content

Commit 38ca777

Browse files
committed
wip
1 parent b5ec557 commit 38ca777

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

crates/sdk/src/network/client.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use reqwest_middleware::ClientWithMiddleware as HttpClientWithMiddleware;
1515
use serde::{de::DeserializeOwned, Serialize};
1616
use sp1_core_machine::io::SP1Stdin;
1717
use sp1_prover::{HashableKey, SP1VerifyingKey};
18-
use tonic::{transport::Channel, Code};
1918
use tokio::sync::OnceCell;
19+
use tonic::{transport::Channel, Code};
2020

2121
use super::{
2222
grpc,
@@ -478,11 +478,20 @@ impl NetworkClient {
478478
}
479479

480480
pub(crate) async fn get_channel(&self) -> Result<Channel> {
481-
Ok(self.channel.get_or_try_init(|| async {
482-
let channel = grpc::configure_endpoint(&self.rpc_url)?.connect().await?;
483-
Ok(channel)
484-
})
485-
.await.map_err(|e| anyhow::anyhow!("Failed to connect: {:?}", e))?.clone())
481+
Ok(self
482+
.channel
483+
.get_or_try_init(|| {
484+
self.with_retry(
485+
|| async {
486+
let channel = grpc::configure_endpoint(&self.rpc_url)?.connect().await?;
487+
Ok(channel)
488+
},
489+
"connecting to network rpc",
490+
)
491+
})
492+
.await
493+
.map_err(|e| anyhow::anyhow!("Failed to connect: {:?}", e))?
494+
.clone())
486495
}
487496

488497
pub(crate) async fn prover_network_client(&self) -> Result<ProverNetworkClient<Channel>> {

0 commit comments

Comments
 (0)