Refetch when a 304 arrives with nothing stored, and soften a skip reason

Deleting entries during a cleanup left each feed's ETag in place, so the
rescan got 304s, skipped parsing, and 57 feeds stayed empty until a
publisher happened to change something. A 304 while the feed holds zero
entries means the validator has outlived the data, so the daemon drops it
and asks again.

"not a wanted media type" was jargon, and storing it in last_error painted
an ordinary filter decision red. It reads "not audio or video" now, and a
reason is only shown as an error when the state actually is one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AdXho5tTkjFLeUXKbEjKBh
This commit is contained in:
2026-09-10 18:14:57 +00:00
parent dd9c0881ee
commit 5190a29cdb
3 changed files with 47 additions and 4 deletions

View File

@@ -795,7 +795,7 @@ async fn scan_one(
feed_cfg: &config::Feed,
state: &db::HttpState,
) -> Result<Outcome> {
let fetched = feed::fetch(
let mut fetched = feed::fetch(
&ctx.client,
feed_cfg,
state.etag.as_deref(),
@@ -803,6 +803,16 @@ async fn scan_one(
)
.await?;
// A 304 while nothing is stored means the validator has outlived the data -- a restore
// from backup, a manual edit, a cleanup that removed entries. Believe the database over
// the validator: drop it and ask again, or the feed stays empty until the publisher
// happens to change something.
if matches!(fetched, feed::Fetched::NotModified) && ctx.db.feed_summary(id)?.entries == 0 {
tracing::info!(feed = id, "not modified, but nothing stored; refetching without the validator");
ctx.db.clear_validators(id)?;
fetched = feed::fetch(&ctx.client, feed_cfg, None, None).await?;
}
let (bytes, etag, last_modified) = match fetched {
feed::Fetched::NotModified => {
ctx.db.touch_feed(id, &feed_cfg.url)?;
@@ -1011,7 +1021,7 @@ fn reject(
.as_deref()
.unwrap_or(&cfg.general.media_types);
if !config::wanted_media(enc.mime.as_deref(), wanted) {
return Some("not a wanted media type");
return Some("not audio or video");
}
if entry.explicit && !feed_cfg.allow_explicit {
return Some("explicit");