mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-10-05 01:12:06 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user