Add grab_enabled kill switch for the passive RSS grab loop

This commit is contained in:
Breadway 2026-07-24 23:20:43 +08:00
parent e179b9bf90
commit 691fb39cbb
2 changed files with 14 additions and 0 deletions

View file

@ -55,6 +55,12 @@ pub struct SourcesConfig {
pub nyaa_rss_url: String,
#[serde(default = "default_grab_poll_interval_secs")]
pub grab_poll_interval_secs: u64,
/// Human kill switch for the passive RSS-feed grab loop (nyaa, anime
/// only) — same reasoning as `search_enabled`/`upgrade_enabled`, kept
/// as its own flag since this loop watches a different source and can
/// need to be paused independently of the search-driven ones.
#[serde(default = "default_grab_enabled")]
pub grab_enabled: bool,
#[serde(default = "default_import_poll_interval_secs")]
pub import_poll_interval_secs: u64,
#[serde(default = "default_search_poll_interval_secs")]
@ -108,6 +114,7 @@ impl Default for SourcesConfig {
torrent_1337x_mirrors: default_1337x_mirrors(),
nyaa_rss_url: default_nyaa_rss_url(),
grab_poll_interval_secs: default_grab_poll_interval_secs(),
grab_enabled: default_grab_enabled(),
import_poll_interval_secs: default_import_poll_interval_secs(),
search_poll_interval_secs: default_search_poll_interval_secs(),
search_budget_per_cycle: default_search_budget_per_cycle(),
@ -161,6 +168,10 @@ fn default_grab_poll_interval_secs() -> u64 {
300
}
fn default_grab_enabled() -> bool {
true
}
fn default_import_poll_interval_secs() -> u64 {
60
}

View file

@ -378,6 +378,9 @@ async fn background_loop(
loop {
tokio::select! {
_ = grab_ticker.tick() => {
if !config.sources.grab_enabled {
continue;
}
let result = {
let conn = conn.lock().await;
scheduler::run_grab_cycle(&conn, &nyaa_source, 1, &mut title_matcher, &qbit, &config.qbit.category).await