Skip to content

Commit

Permalink
Introduce constant for keepalive time + set to 60 secs as per recomme…
Browse files Browse the repository at this point in the history
…nded
  • Loading branch information
edisontim committed Nov 14, 2024
1 parent 756027b commit 1138d8b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/torii/grpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ pub struct WorldClient {
impl WorldClient {
#[cfg(not(target_arch = "wasm32"))]
pub async fn new(dst: String, world_address: Felt) -> Result<Self, Error> {
const KEEPALIVE_TIME: u64 = 60;

let endpoint = Endpoint::from_shared(dst.clone())
.map_err(|e| Error::Endpoint(e.to_string()))?
.tcp_keepalive(Some(Duration::from_secs(30)));
.tcp_keepalive(Some(Duration::from_secs(KEEPALIVE_TIME)));

Check warning on line 58 in crates/torii/grpc/src/client.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/grpc/src/client.rs#L56-L58

Added lines #L56 - L58 were not covered by tests
let channel = endpoint.connect().await.map_err(Error::Transport)?;
Ok(Self {
_world_address: world_address,
Expand Down

0 comments on commit 1138d8b

Please sign in to comment.