Compare commits
No commits in common. "5b9ff9213fe374a462f346b62371a1c26da074dd" and "60478dbf27c8ffd147ee48337ff17ddaed08b9f8" have entirely different histories.
5b9ff9213f
...
60478dbf27
|
@ -112,16 +112,7 @@ impl Post {
|
|||
url: actor.url.unwrap_or(actor.id),
|
||||
bot: actor.actor_type != "Person",
|
||||
},
|
||||
tags: self.tag.into_iter().filter_map(|mut tag| {
|
||||
while tag.name.chars().next() == Some('#') {
|
||||
tag.name.remove(0);
|
||||
}
|
||||
if tag.name.len() > 0 {
|
||||
Some(tag)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}).collect(),
|
||||
tags: self.tag,
|
||||
sensitive: self.sensitive,
|
||||
mentions: vec![],
|
||||
language,
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use std::{
|
||||
sync::Arc,
|
||||
time::SystemTime,
|
||||
time::{Instant, SystemTime},
|
||||
};
|
||||
use http::StatusCode;
|
||||
use metrics::histogram;
|
||||
use serde::Serialize;
|
||||
use sigh::{PrivateKey, SigningConfig, alg::RsaSha256};
|
||||
use super::{digest, error::Error};
|
||||
|
@ -42,14 +43,20 @@ pub async fn send_raw(
|
|||
.header("digest", digest_header)
|
||||
.body(body.as_ref().clone())
|
||||
.map_err(Error::HttpReq)?;
|
||||
let t1 = Instant::now();
|
||||
SigningConfig::new(RsaSha256, private_key, key_id)
|
||||
.sign(&mut req)?;
|
||||
let t2 = Instant::now();
|
||||
let req: reqwest::Request = req.try_into()?;
|
||||
let res = client.execute(req)
|
||||
.await?;
|
||||
let t3 = Instant::now();
|
||||
histogram!("relay_http_request_duration", t2 - t1);
|
||||
if res.status() >= StatusCode::OK && res.status() < StatusCode::MULTIPLE_CHOICES {
|
||||
histogram!("relay_http_response_duration", t3 - t2, "res" => "ok", "host" => host);
|
||||
Ok(())
|
||||
} else {
|
||||
histogram!("relay_http_response_duration", t3 - t2, "res" => "err", "host" => host);
|
||||
tracing::error!("send_raw {} response HTTP {}", url, res.status());
|
||||
let response = res.text().await?;
|
||||
Err(Error::Response(response))
|
||||
|
|
Loading…
Reference in New Issue
Block a user