A feed read in full checked its own artwork and, without one, asked its website for an icon, every time; a feed without validators is read in full every scan, so looking-for-group spent 2 s of every scan loading lfg.co's home page. Now the check runs when the feed names different artwork from what is stored, or the scan was asked for, which keeps #80's point: a refresh still picks up an icon the site changes or fixes. Feed spans ran seconds past their fetch with nothing to say where (#96). The artwork lookup, the loop that stores each item, and the per-feed database calls (feed_summary, record_feed, subscribers, adopt, skipped_by_filter, rehide, pending) now have spans of their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -313,6 +313,7 @@ impl Db {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub async fn feed_summary(&self, feed_id: &str) -> Result<FeedSummary> {
|
||||
let mut sum = feeds::Entity::find_by_id(feed_id.to_owned())
|
||||
.one(&self.orm)
|
||||
@@ -432,6 +433,7 @@ impl Db {
|
||||
|
||||
/// Upsert after a successful poll. Clears any previous error.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub async fn record_feed(
|
||||
&self,
|
||||
feed_id: &str,
|
||||
@@ -623,6 +625,7 @@ pub struct Pending {
|
||||
impl Db {
|
||||
/// The download queue is the table, not the parse result: an enclosure held back by
|
||||
/// `max_new_per_check` is simply picked up by the next scan, in feed order.
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub async fn pending(&self, feed_id: &str, limit: usize) -> Result<Vec<Pending>> {
|
||||
// Newest first: a cap of 3 should mean the three latest episodes, not the three that
|
||||
// happen to have been recorded first.
|
||||
@@ -1191,6 +1194,7 @@ impl Db {
|
||||
/// and downloads, since one file serves the lot.
|
||||
/// In a group, whatever someone has not set on the feed itself comes from their
|
||||
/// subscription to the group, as the group's settings dialog has always said it does.
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub async fn subscribers(&self, feed_id: &str, group: Option<&str>) -> Result<Vec<Sub>> {
|
||||
let rows = self
|
||||
.rows(
|
||||
@@ -1324,6 +1328,7 @@ impl Db {
|
||||
/// ponytail: every item of the feed for every subscriber, each time the feed is scanned with
|
||||
/// something new or a list changes. Fine at hundreds of items a feed; look only at new items
|
||||
/// on a scan if a feed with thousands makes scans slow.
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub async fn rehide(&self, feed_id: &str) -> Result<()> {
|
||||
let lists: Vec<(i64, Vec<String>)> = self
|
||||
.rows(
|
||||
@@ -1730,6 +1735,7 @@ impl Db {
|
||||
/// read state for them. A Patreon creator read as one feed before it was split into shows
|
||||
/// owns every show's files, and `enclosures.url` is unique, so without this each show would
|
||||
/// list its items with nothing to play.
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub async fn adopt(&self, parent: &str, child: &str, listed: &[(&str, &str)]) -> Result<()> {
|
||||
use sea_orm::TransactionTrait;
|
||||
let holds = enclosures::Entity::find()
|
||||
@@ -1773,6 +1779,7 @@ impl Db {
|
||||
/// A feed's enclosures skipped by one of its filters, by URL, with the reason: the verdicts a
|
||||
/// change of settings can overturn. A torrent held back while torrents are off is not a
|
||||
/// filter's call.
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub async fn skipped_by_filter(&self, feed_id: &str) -> Result<std::collections::HashMap<String, String>> {
|
||||
self.rows(
|
||||
"SELECT url, last_error FROM enclosures
|
||||
|
||||
Reference in New Issue
Block a user