chore: tuning oauth and xrpc client timeouts

Changed files
+8 -3
src
+1 -1
src/atproto/client.rs
··· 7 7 use tracing::Instrument; 8 8 9 9 // Standard timeout for all HTTP client operations 10 - const HTTP_CLIENT_TIMEOUT_SECS: u64 = 5; 10 + const HTTP_CLIENT_TIMEOUT_SECS: u64 = 8; 11 11 12 12 use crate::atproto::auth::OAuthSessionProvider; 13 13 use crate::atproto::errors::ClientError;
+7 -2
src/oauth.rs
··· 20 20 }, 21 21 }; 22 22 23 + const HTTP_CLIENT_TIMEOUT_SECS: u64 = 8; 24 + 23 25 pub async fn pds_resources( 24 26 http_client: &reqwest::Client, 25 27 pds: &str, ··· 44 46 45 47 let resource: OAuthProtectedResource = http_client 46 48 .get(destination) 47 - .timeout(Duration::from_secs(2)) 49 + .timeout(Duration::from_secs(HTTP_CLIENT_TIMEOUT_SECS)) 48 50 .send() 49 51 .await 50 52 .map_err(OAuthClientError::OAuthProtectedResourceRequestFailed)? ··· 76 78 77 79 let resource: AuthorizationServer = http_client 78 80 .get(destination) 79 - .timeout(Duration::from_secs(2)) 81 + .timeout(Duration::from_secs(HTTP_CLIENT_TIMEOUT_SECS)) 80 82 .send() 81 83 .await 82 84 .map_err(OAuthClientError::AuthorizationServerRequestFailed)? ··· 273 275 .post(par_url) 274 276 .header("DPoP", dpop_proof_token.as_str()) 275 277 .form(&params) 278 + .timeout(Duration::from_secs(HTTP_CLIENT_TIMEOUT_SECS)) 276 279 .send() 277 280 .await 278 281 .map_err(OAuthClientError::PARMiddlewareRequestFailed)? ··· 369 372 .post(token_endpoint) 370 373 .header("DPoP", dpop_proof_token.as_str()) 371 374 .form(&params) 375 + .timeout(Duration::from_secs(HTTP_CLIENT_TIMEOUT_SECS)) 372 376 .send() 373 377 .await 374 378 .map_err(OAuthClientError::TokenMiddlewareRequestFailed)? ··· 465 469 .post(token_endpoint) 466 470 .header("DPoP", dpop_proof_token.as_str()) 467 471 .form(&params) 472 + .timeout(Duration::from_secs(HTTP_CLIENT_TIMEOUT_SECS)) 468 473 .send() 469 474 .await 470 475 .map_err(OAuthClientError::TokenMiddlewareRequestFailed)?