refactor(db): use rusqlite query_row/optional instead of hand-rolled reads

pending_backlog, earliest_run_after, ChatStore::get and LinkCache::get each
hand-rolled prepare + query + rows.next() for what is a single-row read.
query_row + OptionalExtension::optional is the same statement and the same
error mapping with less scaffolding; the backlog's NULL-on-empty MIN still
goes through the count check, so a pending row with a NULL run_after is not
misread. Also fixes the rustfmt drift from the previous commit.
This commit is contained in:
2026-09-21 17:01:38 +08:00
parent ebe7b8bdd7
commit 5166d97545
4 changed files with 32 additions and 33 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ pub(super) async fn prepare_upload_item(
let media_url = item_url(&item);
if !media_url.starts_with("http://") && !media_url.starts_with("https://") {
let media = media_from_file(&item, std::path::PathBuf::from(media_url), caption)
.map_err(|message| FallbackError::Permanent { message })?;
.map_err(|message| FallbackError::Permanent { message })?;
return Ok(PreparedItem {
index,
media,