Add 5s timeout to LiveKit API requests

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-10-20 16:57:47 +02:00
parent de24b4b4e8
commit be1dc01d9e

View file

@ -3,7 +3,7 @@ use anyhow::{anyhow, Result};
use async_trait::async_trait;
use prost::Message;
use reqwest::header::CONTENT_TYPE;
use std::{future::Future, sync::Arc};
use std::{future::Future, sync::Arc, time::Duration};
#[async_trait]
pub trait Client: Send + Sync {
@ -29,7 +29,10 @@ impl LiveKitClient {
}
Self {
http: reqwest::Client::new(),
http: reqwest::ClientBuilder::new()
.timeout(Duration::from_secs(5))
.build()
.unwrap(),
url: url.into(),
key: key.into(),
secret: secret.into(),