move reqwest client out of thread spawning

this way, we only spawn one, and reuse that.
This commit is contained in:
Igor Galić 2020-02-17 23:37:43 +01:00
parent 65b2c38c29
commit be8c67ee9a
No known key found for this signature in database
GPG Key ID: ACFEFF7F6A123A86

View File

@ -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())