Compare commits

..

No commits in common. "9fbfa378bba3b8bec39f0f5223a4648ec23e4c70" and "416d82042f2445609b792a02325920eef2e32e9c" have entirely different histories.

10 changed files with 232 additions and 572 deletions

759
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -1,6 +1,6 @@
[package] [package]
name = "server" name = "server"
version = "0.0.60" version = "0.0.59"
edition = "2021" edition = "2021"
default-run = "server" default-run = "server"
@ -15,6 +15,7 @@ async-trait = "0.1.81"
build-info = "0.0.38" build-info = "0.0.38"
cacher = {git = "http://git-private.h.xinu.tv/wathiede/cacher.git"} cacher = {git = "http://git-private.h.xinu.tv/wathiede/cacher.git"}
css-inline = "0.13.0" css-inline = "0.13.0"
glog = "0.1.0"
html-escape = "0.2.13" html-escape = "0.2.13"
linkify = "0.10.0" linkify = "0.10.0"
log = "0.4.17" log = "0.4.17"
@ -34,11 +35,8 @@ sqlx = { version = "0.7.4", features = ["postgres", "runtime-tokio", "time"] }
tantivy = "0.22.0" tantivy = "0.22.0"
thiserror = "1.0.37" thiserror = "1.0.37"
tokio = "1.26.0" tokio = "1.26.0"
tracing = "0.1.41"
url = "2.5.2" url = "2.5.2"
urlencoding = "2.1.3" urlencoding = "2.1.3"
#xtracing = { path = "../../xtracing" }
xtracing = { git = "http://git-private.h.xinu.tv/wathiede/xtracing.git" }
[build-dependencies] [build-dependencies]
build-info-build = "0.0.38" build-info-build = "0.0.38"

View File

@ -7,6 +7,7 @@ use std::{error::Error, io::Cursor, str::FromStr};
use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema}; use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema};
use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse}; use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse};
use glog::Flags;
use notmuch::{Notmuch, NotmuchError, ThreadSet}; use notmuch::{Notmuch, NotmuchError, ThreadSet};
use rocket::{ use rocket::{
fairing::AdHoc, fairing::AdHoc,
@ -175,7 +176,14 @@ async fn graphql_request(
#[rocket::main] #[rocket::main]
async fn main() -> Result<(), Box<dyn Error>> { async fn main() -> Result<(), Box<dyn Error>> {
let _guard = xtracing::init(env!("CARGO_BIN_NAME"))?; glog::new()
.init(Flags {
colorlogtostderr: true,
//alsologtostderr: true, // use logtostderr to only write to stderr and not to files
logtostderr: true,
..Default::default()
})
.unwrap();
build_info::build_info!(fn bi); build_info::build_info!(fn bi);
info!("Build Info: {}", shared::build_version(bi)); info!("Build Info: {}", shared::build_version(bi));
let allowed_origins = AllowedOrigins::all(); let allowed_origins = AllowedOrigins::all();

View File

@ -9,7 +9,6 @@ use log::info;
use notmuch::Notmuch; use notmuch::Notmuch;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sqlx::postgres::PgPool; use sqlx::postgres::PgPool;
use tracing::instrument;
use crate::{config::Config, newsreader, nm, tantivy::TantivyConnection, Query}; use crate::{config::Config, newsreader, nm, tantivy::TantivyConnection, Query};
@ -270,7 +269,6 @@ impl QueryRoot {
build_info::build_info!(fn bi); build_info::build_info!(fn bi);
Ok(shared::build_version(bi)) Ok(shared::build_version(bi))
} }
#[instrument(skip_all, fields(query=query))]
async fn count<'ctx>(&self, ctx: &Context<'ctx>, query: String) -> Result<usize, Error> { async fn count<'ctx>(&self, ctx: &Context<'ctx>, query: String) -> Result<usize, Error> {
let nm = ctx.data_unchecked::<Notmuch>(); let nm = ctx.data_unchecked::<Notmuch>();
let pool = ctx.data_unchecked::<PgPool>(); let pool = ctx.data_unchecked::<PgPool>();
@ -286,7 +284,6 @@ impl QueryRoot {
Ok(total) Ok(total)
} }
#[instrument(skip_all, fields(query=query))]
async fn search<'ctx>( async fn search<'ctx>(
&self, &self,
ctx: &Context<'ctx>, ctx: &Context<'ctx>,
@ -421,7 +418,6 @@ impl QueryRoot {
.await?) .await?)
} }
#[instrument(skip_all)]
async fn tags<'ctx>(&self, ctx: &Context<'ctx>) -> FieldResult<Vec<Tag>> { async fn tags<'ctx>(&self, ctx: &Context<'ctx>) -> FieldResult<Vec<Tag>> {
let nm = ctx.data_unchecked::<Notmuch>(); let nm = ctx.data_unchecked::<Notmuch>();
let pool = ctx.data_unchecked::<PgPool>(); let pool = ctx.data_unchecked::<PgPool>();
@ -430,7 +426,6 @@ impl QueryRoot {
tags.append(&mut nm::tags(nm, needs_unread)?); tags.append(&mut nm::tags(nm, needs_unread)?);
Ok(tags) Ok(tags)
} }
#[instrument(skip_all, fields(thread_id=thread_id))]
async fn thread<'ctx>(&self, ctx: &Context<'ctx>, thread_id: String) -> Result<Thread, Error> { async fn thread<'ctx>(&self, ctx: &Context<'ctx>, thread_id: String) -> Result<Thread, Error> {
let nm = ctx.data_unchecked::<Notmuch>(); let nm = ctx.data_unchecked::<Notmuch>();
let pool = ctx.data_unchecked::<PgPool>(); let pool = ctx.data_unchecked::<PgPool>();
@ -505,7 +500,6 @@ async fn tantivy_search(
pub struct Mutation; pub struct Mutation;
#[Object] #[Object]
impl Mutation { impl Mutation {
#[instrument(skip_all, fields(query, bool))]
async fn set_read_status<'ctx>( async fn set_read_status<'ctx>(
&self, &self,
ctx: &Context<'ctx>, ctx: &Context<'ctx>,
@ -522,7 +516,6 @@ impl Mutation {
nm::set_read_status(nm, &query, unread).await?; nm::set_read_status(nm, &query, unread).await?;
Ok(true) Ok(true)
} }
#[instrument(skip_all, fields(query, tag))]
async fn tag_add<'ctx>( async fn tag_add<'ctx>(
&self, &self,
ctx: &Context<'ctx>, ctx: &Context<'ctx>,
@ -534,7 +527,6 @@ impl Mutation {
nm.tag_add(&tag, &query)?; nm.tag_add(&tag, &query)?;
Ok(true) Ok(true)
} }
#[instrument(skip_all, fields(query, tag))]
async fn tag_remove<'ctx>( async fn tag_remove<'ctx>(
&self, &self,
ctx: &Context<'ctx>, ctx: &Context<'ctx>,
@ -556,7 +548,6 @@ impl Mutation {
Ok(true) Ok(true)
} }
#[instrument(skip_all)]
async fn refresh<'ctx>(&self, ctx: &Context<'ctx>) -> Result<bool, Error> { async fn refresh<'ctx>(&self, ctx: &Context<'ctx>) -> Result<bool, Error> {
let nm = ctx.data_unchecked::<Notmuch>(); let nm = ctx.data_unchecked::<Notmuch>();
let tantivy = ctx.data_unchecked::<TantivyConnection>(); let tantivy = ctx.data_unchecked::<TantivyConnection>();

View File

@ -9,7 +9,6 @@ use log::{error, info, warn};
use mailparse::{parse_content_type, parse_mail, MailHeader, MailHeaderMap, ParsedMail}; use mailparse::{parse_content_type, parse_mail, MailHeader, MailHeaderMap, ParsedMail};
use memmap::MmapOptions; use memmap::MmapOptions;
use notmuch::Notmuch; use notmuch::Notmuch;
use tracing::instrument;
use crate::{ use crate::{
compute_offset_limit, compute_offset_limit,
@ -49,7 +48,6 @@ pub fn threadset_to_messages(thread_set: notmuch::ThreadSet) -> Result<Vec<Messa
Ok(Vec::new()) Ok(Vec::new())
} }
#[instrument(name="nm::count", skip_all, fields(query=?query))]
pub async fn count(nm: &Notmuch, query: &Query) -> Result<usize, ServerError> { pub async fn count(nm: &Notmuch, query: &Query) -> Result<usize, ServerError> {
if !is_notmuch_query(query) { if !is_notmuch_query(query) {
return Ok(0); return Ok(0);
@ -58,7 +56,6 @@ pub async fn count(nm: &Notmuch, query: &Query) -> Result<usize, ServerError> {
Ok(nm.count(&query)?) Ok(nm.count(&query)?)
} }
#[instrument(name="nm::search", skip_all, fields(query=?query))]
pub async fn search( pub async fn search(
nm: &Notmuch, nm: &Notmuch,
after: Option<i32>, after: Option<i32>,
@ -102,7 +99,6 @@ pub async fn search(
.collect()) .collect())
} }
#[instrument(name="nm::tags", skip_all, fields(needs_unread=needs_unread))]
pub fn tags(nm: &Notmuch, needs_unread: bool) -> Result<Vec<Tag>, ServerError> { pub fn tags(nm: &Notmuch, needs_unread: bool) -> Result<Vec<Tag>, ServerError> {
let now = Instant::now(); let now = Instant::now();
let unread_msg_cnt: HashMap<String, usize> = if needs_unread { let unread_msg_cnt: HashMap<String, usize> = if needs_unread {
@ -144,7 +140,6 @@ pub fn tags(nm: &Notmuch, needs_unread: bool) -> Result<Vec<Tag>, ServerError> {
Ok(tags) Ok(tags)
} }
#[instrument(name="nm::thread", skip_all, fields(thread_id=thread_id))]
pub async fn thread( pub async fn thread(
nm: &Notmuch, nm: &Notmuch,
thread_id: String, thread_id: String,
@ -856,7 +851,6 @@ fn render_content_type_tree(m: &ParsedMail) -> String {
) )
} }
#[instrument(name="nm::set_read_status", skip_all, fields(query=?query, unread=unread))]
pub async fn set_read_status<'ctx>( pub async fn set_read_status<'ctx>(
nm: &Notmuch, nm: &Notmuch,
query: &Query, query: &Query,

View File

@ -9,7 +9,6 @@ use tantivy::{
schema::{Facet, IndexRecordOption, Value}, schema::{Facet, IndexRecordOption, Value},
DocAddress, Index, Searcher, TantivyDocument, TantivyError, Term, DocAddress, Index, Searcher, TantivyDocument, TantivyError, Term,
}; };
use tracing::instrument;
use crate::{ use crate::{
compute_offset_limit, compute_offset_limit,
@ -43,7 +42,6 @@ impl TantivyConnection {
db_path: tantivy_db_path.to_string(), db_path: tantivy_db_path.to_string(),
}) })
} }
#[instrument(name = "tantivy::refresh", skip_all)]
pub async fn refresh(&self, pool: &PgPool) -> Result<(), ServerError> { pub async fn refresh(&self, pool: &PgPool) -> Result<(), ServerError> {
let start_time = std::time::Instant::now(); let start_time = std::time::Instant::now();
let p_uids: Vec<_> = sqlx::query_file!("sql/all-uids.sql") let p_uids: Vec<_> = sqlx::query_file!("sql/all-uids.sql")
@ -169,7 +167,6 @@ impl TantivyConnection {
index_writer.commit()?; index_writer.commit()?;
Ok(()) Ok(())
} }
#[instrument(name = "tantivy::reindex_thread", skip_all, fields(query=?query))]
pub async fn reindex_thread(&self, pool: &PgPool, query: &Query) -> Result<(), ServerError> { pub async fn reindex_thread(&self, pool: &PgPool, query: &Query) -> Result<(), ServerError> {
let uids: Vec<_> = query let uids: Vec<_> = query
.uids .uids
@ -179,7 +176,6 @@ impl TantivyConnection {
.collect(); .collect();
Ok(self.reindex_uids(pool, &uids).await?) Ok(self.reindex_uids(pool, &uids).await?)
} }
#[instrument(name = "tantivy::reindex_all", skip_all)]
pub async fn reindex_all(&self, pool: &PgPool) -> Result<(), ServerError> { pub async fn reindex_all(&self, pool: &PgPool) -> Result<(), ServerError> {
let rows = sqlx::query_file!("sql/all-posts.sql") let rows = sqlx::query_file!("sql/all-posts.sql")
.fetch_all(pool) .fetch_all(pool)
@ -228,7 +224,6 @@ impl TantivyConnection {
Ok((searcher, Box::new(search_query))) Ok((searcher, Box::new(search_query)))
} }
#[instrument(name="tantivy::count", skip_all, fields(query=?query))]
pub async fn count(&self, query: &Query) -> Result<usize, ServerError> { pub async fn count(&self, query: &Query) -> Result<usize, ServerError> {
if !is_tantivy_query(query) { if !is_tantivy_query(query) {
return Ok(0); return Ok(0);
@ -238,7 +233,6 @@ impl TantivyConnection {
let (searcher, query) = self.searcher_and_query(&query)?; let (searcher, query) = self.searcher_and_query(&query)?;
Ok(searcher.search(&query, &Count)?) Ok(searcher.search(&query, &Count)?)
} }
#[instrument(name="tantivy::search", skip_all, fields(query=?query))]
pub async fn search( pub async fn search(
&self, &self,
pool: &PgPool, pool: &PgPool,

View File

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

View File

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