move reqwest client out of thread spawning
this way, we only spawn one, and reuse that.
This commit is contained in:
parent
65b2c38c29
commit
be8c67ee9a
@ -151,12 +151,12 @@ where
|
|||||||
let mut headers = request::headers();
|
let mut headers = request::headers();
|
||||||
headers.insert("Digest", request::Digest::digest(&body));
|
headers.insert("Digest", request::Digest::digest(&body));
|
||||||
let sig = request::signature(sender, &headers)
|
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 {
|
rt.spawn(async move {
|
||||||
let client = ClientBuilder::new()
|
|
||||||
.connect_timeout(std::time::Duration::from_secs(5))
|
|
||||||
.build()
|
|
||||||
.expect("Can't build client");
|
|
||||||
client
|
client
|
||||||
.post(&inbox)
|
.post(&inbox)
|
||||||
.headers(headers.clone())
|
.headers(headers.clone())
|
||||||
|
Loading…
Reference in New Issue
Block a user