increase runtime test timout to 100s
This commit is contained in:
@@ -37,6 +37,7 @@ pub static ALL_PROVIDERS: Lazy<HashMap<&'static str, DynProvider>> = Lazy::new(|
|
||||
const CHANNEL_STATUS_ERROR: &str = "error";
|
||||
const VALIDATION_RESULTS_REQUIRED: usize = 5;
|
||||
const VALIDATION_COOLDOWN: Duration = Duration::from_secs(60);
|
||||
const VALIDATION_MEDIA_TIMEOUT: Duration = Duration::from_secs(100);
|
||||
|
||||
#[derive(Clone)]
|
||||
struct ProviderValidationContext {
|
||||
@@ -143,7 +144,7 @@ async fn validate_media_response(
|
||||
|
||||
let mut requester = requester;
|
||||
let response = requester
|
||||
.get_raw_with_headers(url, headers)
|
||||
.get_raw_with_headers_timeout(url, headers, Some(VALIDATION_MEDIA_TIMEOUT))
|
||||
.await
|
||||
.map_err(|err| {
|
||||
format!(
|
||||
@@ -886,7 +887,7 @@ mod tests {
|
||||
|
||||
let mut requester = Requester::new();
|
||||
let response = requester
|
||||
.get_raw_with_headers(url, headers)
|
||||
.get_raw_with_headers_timeout(url, headers, Some(VALIDATION_MEDIA_TIMEOUT))
|
||||
.await
|
||||
.map_err(|err| format!("{provider_id} item {} request failed for {url}: {err}", item_index + 1))?;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ use serde::Serialize;
|
||||
use std::env;
|
||||
use std::fmt;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use std::time::Duration;
|
||||
use wreq::Client;
|
||||
use wreq::Proxy;
|
||||
use wreq::Response;
|
||||
@@ -256,6 +257,15 @@ impl Requester {
|
||||
&mut self,
|
||||
url: &str,
|
||||
headers: Vec<(String, String)>,
|
||||
) -> Result<Response, wreq::Error> {
|
||||
self.get_raw_with_headers_timeout(url, headers, None).await
|
||||
}
|
||||
|
||||
pub async fn get_raw_with_headers_timeout(
|
||||
&mut self,
|
||||
url: &str,
|
||||
headers: Vec<(String, String)>,
|
||||
timeout: Option<Duration>,
|
||||
) -> Result<Response, wreq::Error> {
|
||||
let cookie_preview = self.debug_cookie_preview_from_owned_headers(url, &headers);
|
||||
#[cfg(not(feature = "debug"))]
|
||||
@@ -271,6 +281,9 @@ impl Requester {
|
||||
let client = Self::build_client(self.cookie_jar.clone(), self.user_agent.as_deref());
|
||||
|
||||
let mut request = client.get(url).version(Version::HTTP_11);
|
||||
if let Some(timeout) = timeout {
|
||||
request = request.timeout(timeout);
|
||||
}
|
||||
|
||||
if self.proxy {
|
||||
if let Ok(proxy_url) = env::var("BURP_URL") {
|
||||
|
||||
Reference in New Issue
Block a user