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/webmentions/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/webmentions') diff --git a/src/webmentions/mod.rs b/src/webmentions/mod.rs index d5a617e..22701b4 100644 --- a/src/webmentions/mod.rs +++ b/src/webmentions/mod.rs @@ -102,7 +102,7 @@ enum Error { Storage(StorageError) } -async fn process_webmentions_from_queue, S: Storage + 'static>(queue: Q, db: S, http: reqwest::Client) -> Result> { +async fn process_webmentions_from_queue, S: Storage + 'static>(queue: Q, db: S, http: reqwest_middleware::ClientWithMiddleware) -> Result> { use futures_util::StreamExt; use self::queue::Job; @@ -177,11 +177,11 @@ pub fn supervised_webmentions_task SupervisedTask -where reqwest::Client: FromRef +where reqwest_middleware::ClientWithMiddleware: FromRef { let queue = Q::from_ref(state); let storage = S::from_ref(state); - let http = reqwest::Client::from_ref(state); + let http = reqwest_middleware::ClientWithMiddleware::from_ref(state); supervisor::, _, _>(move || process_webmentions_from_queue( queue.clone(), storage.clone(), http.clone() ), cancellation_token) -- cgit 1.4.1