A listed feed nobody subscribes to downloads nothing (#107)

With no subscribers a feed falls back to its own settings, where auto_download is on, so a
listed feed with audio would have downloaded files for no one. The seeded news feeds carry
only images, which media_types already skips, so nothing was downloaded. Files skipped for it
are judged again, by the new subscriber's settings, on the next scan after someone subscribes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 21:20:09 +00:00
parent 142610e8b8
commit d52ecfcbd7
2 changed files with 14 additions and 2 deletions

View File

@@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- The Directory lists feeds nobody subscribes to yet; Popular still lists what people subscribe to. - The Directory lists feeds nobody subscribes to yet; Popular still lists what people subscribe to.
A feed nobody subscribes to is checked once a day, and at once when someone subscribes. A feed nobody subscribes to is checked once a day, and at once when someone subscribes. A
listed feed downloads nothing until someone subscribes.
- The Directory loads faster: it asked the database three questions per feed. - The Directory loads faster: it asked the database three questions per feed.
## [0.9.1] - 2026-09-29 ## [0.9.1] - 2026-09-29

View File

@@ -1725,7 +1725,10 @@ fn merge_policy(subs: &[db::Sub], feed_cfg: &config::Feed, global: usize) -> Pol
if subs.is_empty() { if subs.is_empty() {
return Policy { return Policy {
auto_download: feed_cfg.auto_download, // A feed listed in the Directory with nobody subscribed is there to be found, not
// downloaded: its files would be for no one. Once someone subscribes, the files
// skipped for it are judged again on the next scan, by their settings (#107).
auto_download: feed_cfg.auto_download && !feed_cfg.listed,
allow_explicit: feed_cfg.allow_explicit, allow_explicit: feed_cfg.allow_explicit,
wants: vec![Want { keywords: feed_cfg.keywords.clone(), blocked: vec![] }], wants: vec![Want { keywords: feed_cfg.keywords.clone(), blocked: vec![] }],
budget: cap(feed_cfg.max_new_per_check), budget: cap(feed_cfg.max_new_per_check),
@@ -1958,6 +1961,14 @@ fn duration(secs: u64) -> String {
mod tests { mod tests {
use super::*; use super::*;
#[test]
fn a_listed_feed_nobody_subscribes_to_downloads_nothing() {
let mut f = feed();
assert!(merge_policy(&[], &f, 3).auto_download);
f.listed = true;
assert!(!merge_policy(&[], &f, 3).auto_download);
}
#[test] #[test]
fn a_failing_feed_backs_off_doubling_up_to_a_day() { fn a_failing_feed_backs_off_doubling_up_to_a_day() {
let hour = 3600; let hour = 3600;