From 31a0bdad439a4575c1686f690e9e72bd44dde472 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 26 Aug 2024 15:22:29 +0300 Subject: Add HTTP fetcher cache It just does its thing in the background, potentially speeding up things. Maybe I could also use the underlying in-memory cache implementation (Moka) to speed up my database. I heard crates.io got some good results from that. --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 596ffc0..5fe3b18 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,7 @@ Q: JobQueue + Sized pub storage: S, pub media_store: M, pub job_queue: Q, - pub http: reqwest::Client, + pub http: reqwest_middleware::ClientWithMiddleware, pub background_jobs: Arc>>, pub cookie_key: Key, pub session_store: SessionStore @@ -156,7 +156,7 @@ where A: AuthBackend, S: Storage, M: MediaStore, Q: JobQueue FromRef> for reqwest::Client +impl FromRef> for reqwest_middleware::ClientWithMiddleware where A: AuthBackend, S: Storage, M: MediaStore, Q: JobQueue { fn from_ref(input: &AppState) -> Self { @@ -291,7 +291,7 @@ A: AuthBackend + 'static + FromRef, S: Storage + 'static + FromRef, M: MediaStore + 'static + FromRef, Q: kittybox_util::queue::JobQueue + FromRef, -reqwest::Client: FromRef, +reqwest_middleware::ClientWithMiddleware: FromRef, Arc>>: FromRef, crate::SessionStore: FromRef, axum_extra::extract::cookie::Key: FromRef, -- cgit 1.4.1