Compare commits

...

3 Commits

Author SHA1 Message Date
607e9e2251 Bumping version to 0.0.66 2024-12-16 08:56:24 -08:00
c547170efb server: address lint 2024-12-16 08:56:16 -08:00
0222985f4d server: instrument newsreader impl 2024-12-16 08:56:05 -08:00
8 changed files with 17 additions and 12 deletions

10
Cargo.lock generated
View File

@ -2509,7 +2509,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "letterbox"
version = "0.0.65"
version = "0.0.66"
dependencies = [
"build-info",
"build-info-build",
@ -3024,7 +3024,7 @@ dependencies = [
[[package]]
name = "notmuch"
version = "0.0.65"
version = "0.0.66"
dependencies = [
"itertools 0.10.5",
"log",
@ -3810,7 +3810,7 @@ dependencies = [
[[package]]
name = "procmail2notmuch"
version = "0.0.65"
version = "0.0.66"
dependencies = [
"anyhow",
]
@ -4782,7 +4782,7 @@ dependencies = [
[[package]]
name = "server"
version = "0.0.65"
version = "0.0.66"
dependencies = [
"ammonia",
"anyhow",
@ -4882,7 +4882,7 @@ dependencies = [
[[package]]
name = "shared"
version = "0.0.65"
version = "0.0.66"
dependencies = [
"build-info",
"notmuch",

View File

@ -1,6 +1,6 @@
[package]
name = "notmuch"
version = "0.0.65"
version = "0.0.66"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "procmail2notmuch"
version = "0.0.65"
version = "0.0.66"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "server"
version = "0.0.65"
version = "0.0.66"
edition = "2021"
default-run = "server"

View File

@ -7,6 +7,7 @@ use scraper::Selector;
use shared::compute_color;
use sqlx::postgres::PgPool;
use tokio::sync::Mutex;
use tracing::instrument;
use url::Url;
use crate::{
@ -52,6 +53,7 @@ fn site_from_tags(tags: &[String]) -> Option<String> {
None
}
#[instrument(name = "newsreader::count", skip_all, fields(query=%query))]
pub async fn count(pool: &PgPool, query: &Query) -> Result<usize, ServerError> {
if !is_newsreader_query(query) {
return Ok(0);
@ -75,6 +77,7 @@ pub async fn count(pool: &PgPool, query: &Query) -> Result<usize, ServerError> {
Ok(row.count.unwrap_or(0).try_into().unwrap_or(0))
}
#[instrument(name = "newsreader::search", skip_all, fields(query=%query))]
pub async fn search(
pool: &PgPool,
after: Option<i32>,
@ -141,6 +144,7 @@ pub async fn search(
}
Ok(res)
}
#[instrument(name = "newsreader::tags", skip_all, fields(needs_unread=%_needs_unread))]
pub async fn tags(pool: &PgPool, _needs_unread: bool) -> Result<Vec<Tag>, ServerError> {
// TODO: optimize query by using needs_unread
let tags = sqlx::query_file!("sql/tags.sql").fetch_all(pool).await?;
@ -164,6 +168,7 @@ pub async fn tags(pool: &PgPool, _needs_unread: bool) -> Result<Vec<Tag>, Server
Ok(tags)
}
#[instrument(name = "newsreader::thread", skip_all, fields(thread_id=%thread_id))]
pub async fn thread(
config: &Config,
pool: &PgPool,
@ -280,6 +285,7 @@ pub async fn thread(
timestamp,
}))
}
#[instrument(name = "newsreader::set_read_status", skip_all, fields(query=%query,unread=%unread))]
pub async fn set_read_status<'ctx>(
pool: &PgPool,
query: &Query,

View File

@ -143,8 +143,7 @@ impl TantivyConnection {
rows.len()
);
}
let total = rows.len();
for (i, r) in rows.into_iter().enumerate() {
for r in rows {
let id_term = Term::from_field_text(uid, &r.uid);
index_writer.delete_term(id_term);
let slug = r.site;

View File

@ -1,6 +1,6 @@
[package]
name = "shared"
version = "0.0.65"
version = "0.0.66"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,5 +1,5 @@
[package]
version = "0.0.65"
version = "0.0.66"
name = "letterbox"
repository = "https://github.com/seed-rs/seed-quickstart"
authors = ["Bill Thiede <git@xinu.tv>"]