From be8c67ee9a9bb89661f7cd344f75ae198f7844ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Mon, 17 Feb 2020 23:37:43 +0100 Subject: [PATCH] move reqwest client out of thread spawning this way, we only spawn one, and reuse that. --- plume-common/src/activity_pub/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index 6f81528c..6efb3869 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -151,12 +151,12 @@ where let mut headers = request::headers(); headers.insert("Digest", request::Digest::digest(&body)); let sig = request::signature(sender, &headers) - .expect("activity_pub::broadcast: request signature error"); + .expect("activity_pub::broadcast: request signature error"); + let client = ClientBuilder::new() + .connect_timeout(std::time::Duration::from_secs(5)) + .build() + .expect("Can't build client"); rt.spawn(async move { - let client = ClientBuilder::new() - .connect_timeout(std::time::Duration::from_secs(5)) - .build() - .expect("Can't build client"); client .post(&inbox) .headers(headers.clone())