This commit is contained in:
Astro 2024-03-27 22:10:24 +01:00
parent 295a7791be
commit 1237f8e701
2 changed files with 9 additions and 21 deletions

View File

@ -160,20 +160,14 @@ impl Store {
return;
}
let host = match post.url_host() {
Some(host) => host,
None => {
tracing::warn!("no url_host");
return;
},
let Some(host) = post.url_host() else {
tracing::warn!("no url_host");
return;
};
let timestamp = match post.timestamp() {
Some(timestamp) => timestamp,
None => {
tracing::warn!("no timestamp");
return;
}
let Some(timestamp) = post.timestamp() else {
tracing::warn!("no timestamp");
return;
};
let hour = timestamp.to_utc().timestamp() as u64 / 3600;
let until = current_hour();
@ -389,9 +383,7 @@ impl Store {
let mut results = Vec::with_capacity(names.len());
for name in names {
let hash_values = if let Some(Value::Bulk(hash_values)) = values.next() {
hash_values
} else {
let Some(Value::Bulk(hash_values)) = values.next() else {
panic!("hash_values");
};
let hash_values = hash_values.iter()

View File

@ -141,9 +141,7 @@ async fn main() {
let author: activitypub::Actor = if let Some(author_url) = &post.attributed_to {
if let Ok(url) = Url::parse(author_url) {
let host = if let Some(host) = url.host_str() {
host
} else {
let Some(host) = url.host_str() else {
tracing::error!("No host in author {author_url}");
return;
};
@ -183,9 +181,7 @@ async fn main() {
} else {
"update"
}.to_string();
let encodable_post = if let Ok(post) = feed::EncodablePost::from_post(event_type, feed_post) {
post
} else {
let Ok(encodable_post) = feed::EncodablePost::from_post(event_type, feed_post) else {
tracing::error!("Cannot serialize post {id}");
metrics::counter!("sieve_activity", 1, "type" => "serialize_error");
return;