about summary refs log tree commit diff
path: root/src/webmentions
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2024-08-26 15:22:29 +0300
committerVika <vika@fireburn.ru>2024-08-26 15:23:22 +0300
commit31a0bdad439a4575c1686f690e9e72bd44dde472 (patch)
tree6b8c9132c19445d997bd75964604b069ffbd573f /src/webmentions
parentc79e950ca22c7a957c11e510700664327b042115 (diff)
downloadkittybox-31a0bdad439a4575c1686f690e9e72bd44dde472.tar.zst
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.
Diffstat (limited to 'src/webmentions')
-rw-r--r--src/webmentions/mod.rs6
1 files changed, 3 insertions, 3 deletions
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<Q: std::error::Error + std::fmt::Debug + Send + 'static> {
     Storage(StorageError)
 }
 
-async fn process_webmentions_from_queue<Q: JobQueue<Webmention>, S: Storage + 'static>(queue: Q, db: S, http: reqwest::Client) -> Result<std::convert::Infallible, Error<Q::Error>> {
+async fn process_webmentions_from_queue<Q: JobQueue<Webmention>, S: Storage + 'static>(queue: Q, db: S, http: reqwest_middleware::ClientWithMiddleware) -> Result<std::convert::Infallible, Error<Q::Error>> {
     use futures_util::StreamExt;
     use self::queue::Job;
 
@@ -177,11 +177,11 @@ pub fn supervised_webmentions_task<St: Send + Sync + 'static, S: Storage + FromR
     state: &St,
     cancellation_token: tokio_util::sync::CancellationToken
 ) -> SupervisedTask
-where reqwest::Client: FromRef<St>
+where reqwest_middleware::ClientWithMiddleware: FromRef<St>
 {
     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::<Error<Q::Error>, _, _>(move || process_webmentions_from_queue(
         queue.clone(), storage.clone(), http.clone()
     ), cancellation_token)