about summary refs log tree commit diff
path: root/src/frontend
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/frontend
parentc79e950ca22c7a957c11e510700664327b042115 (diff)
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/frontend')
-rw-r--r--src/frontend/onboarding.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/frontend/onboarding.rs b/src/frontend/onboarding.rs
index be1669f..a8d2ae6 100644
--- a/src/frontend/onboarding.rs
+++ b/src/frontend/onboarding.rs
@@ -53,7 +53,7 @@ async fn onboard<D: Storage + 'static>(
     db: D,
     user_uid: url::Url,
     data: OnboardingData,
-    http: reqwest::Client,
+    http: reqwest_middleware::ClientWithMiddleware,
     jobset: Arc<Mutex<JoinSet<()>>>,
 ) -> Result<(), FrontendError> {
     // Create a user to pass to the backend
@@ -126,7 +126,7 @@ async fn onboard<D: Storage + 'static>(
 pub async fn post<D: Storage + 'static>(
     State(db): State<D>,
     Host(host): Host,
-    State(http): State<reqwest::Client>,
+    State(http): State<reqwest_middleware::ClientWithMiddleware>,
     State(jobset): State<Arc<Mutex<JoinSet<()>>>>,
     Json(data): Json<OnboardingData>,
 ) -> axum::response::Response {
@@ -165,7 +165,7 @@ pub fn router<St, S>() -> axum::routing::MethodRouter<St>
 where
     S: Storage + FromRef<St> + 'static,
     Arc<Mutex<JoinSet<()>>>: FromRef<St>,
-    reqwest::Client: FromRef<St>,
+    reqwest_middleware::ClientWithMiddleware: FromRef<St>,
     St: Clone + Send + Sync + 'static,
 {
     axum::routing::get(get)