Skip to content
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

Feat/config websocket timeout 0.3 #111

Closed
wants to merge 5 commits into from
Closed
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
15 changes: 9 additions & 6 deletions src/admin_websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,22 @@ impl AdminWebsocket {
/// As string `"localhost:30000"`
/// As tuple `([127.0.0.1], 30000)`
pub async fn connect(socket_addr: impl ToSocketAddrs) -> Result<Self> {
let addr = socket_addr
.to_socket_addrs()?
.next()
.expect("invalid websocket address");
// app installation takes > 2 min on CI at the moment, hence the high
// request timeout
let mut websocket_config = WebsocketConfig::CLIENT_DEFAULT;
websocket_config.default_request_timeout = std::time::Duration::from_secs(180);

let websocket_config = Arc::new(websocket_config);
Self::connect_with_config(socket_addr, Arc::new(websocket_config)).await
}

/// Connect to a Conductor API AdminWebsocket with a custom WebsocketConfig.
pub async fn connect_with_config(socket_addr: impl ToSocketAddrs, config: Arc<WebsocketConfig>) -> Result<Self> {
let addr = socket_addr
.to_socket_addrs()?
.next()
.expect("invalid websocket address");
let (tx, mut rx) = again::retry(|| {
let websocket_config = Arc::clone(&websocket_config);
let websocket_config = Arc::clone(&config);
connect(websocket_config, addr)
})
.await?;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub use holochain_types::{
app::{InstallAppPayload, InstalledAppId},
dna::AgentPubKey,
};
pub use holochain_websocket::WebsocketConfig;
pub use signing::client_signing::{ClientAgentSigner, SigningCredentials};
#[cfg(feature = "lair_signing")]
pub use signing::lair_signing::LairAgentSigner;
Expand Down