diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-07-15 07:04:59 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-07-15 07:04:59 +0200 |
commit | 32cb3cd0ac414490e9bd614f8faa59a5bb9ca4e2 (patch) | |
tree | 3cae3d52bb4c981608b734503dfe5cf884416a9d /crates | |
parent | feat(crates/yt/watch): Support `--headless` and `--provide-ipc-socket` flags (diff) | |
download | yt-32cb3cd0ac414490e9bd614f8faa59a5bb9ca4e2.zip |
fix(crates/yt/update): Remove the `--grouped` update support
Our python implementation no longer leaks memory.
Diffstat (limited to 'crates')
-rw-r--r-- | crates/yt/src/cli.rs | 23 | ||||
-rw-r--r-- | crates/yt/src/main.rs | 55 | ||||
-rw-r--r-- | crates/yt/src/update/mod.rs | 2 |
3 files changed, 1 insertions, 79 deletions
diff --git a/crates/yt/src/cli.rs b/crates/yt/src/cli.rs index dc200eb..cd7ce2f 100644 --- a/crates/yt/src/cli.rs +++ b/crates/yt/src/cli.rs @@ -145,32 +145,9 @@ pub(crate) enum Command { #[arg(short, long)] max_backlog: Option<usize>, - /// How many subs were already checked. - /// - /// Only used in the progress display in combination with `--grouped`. - #[arg(short, long, hide = true)] - current_progress: Option<usize>, - - /// How many subs are to be checked. - /// - /// Only used in the progress display in combination with `--grouped`. - #[arg(short, long, hide = true)] - total_number: Option<usize>, - /// The subscriptions to update #[arg(add = ArgValueCompleter::new(complete_subscription))] subscriptions: Vec<String>, - - /// Perform the updates in blocks. - /// - /// This works around the memory leaks in the default update invocation. - #[arg( - short, - long, - conflicts_with = "total_number", - conflicts_with = "current_progress" - )] - grouped: bool, }, /// Manipulate subscription diff --git a/crates/yt/src/main.rs b/crates/yt/src/main.rs index fcbe0da..f9f48bf 100644 --- a/crates/yt/src/main.rs +++ b/crates/yt/src/main.rs @@ -168,9 +168,6 @@ async fn main() -> Result<()> { Command::Update { max_backlog, subscriptions, - grouped, - current_progress, - total_number, } => { let all_subs = Subscriptions::get(&app).await?; @@ -185,57 +182,7 @@ async fn main() -> Result<()> { let max_backlog = max_backlog.unwrap_or(app.config.update.max_backlog); - if grouped { - const CHUNK_SIZE: usize = 50; - - assert!(current_progress.is_none() && total_number.is_none()); - - let subs = { - if subscriptions.is_empty() { - all_subs.0.into_iter().map(|sub| sub.0).collect() - } else { - subscriptions - } - }; - - let total_number = subs.len(); - let mut current_progress = 0; - for chunk in subs.chunks(CHUNK_SIZE) { - info!( - "$ yt update {}", - chunk - .iter() - .map(|sub_name| format!("{sub_name:#?}")) - .collect::<Vec<_>>() - .join(" ") - ); - - let status = std::process::Command::new( - current_exe().context("Failed to get the current exe to re-execute")?, - ) - .args((0..args.verbosity).map(|_| "-v")) - .arg("update") - .args(["--current-progress", current_progress.to_string().as_str()]) - .args(["--total-number", total_number.to_string().as_str()]) - .args(chunk) - .status()?; - - if !status.success() { - bail!("grouped yt update: Child process failed."); - } - - current_progress += CHUNK_SIZE; - } - } else { - update::update( - &app, - max_backlog, - subscriptions, - total_number, - current_progress, - ) - .await?; - } + update::update(&app, max_backlog, subscriptions).await?; } Command::Subscriptions { cmd } => match cmd { SubscriptionCommand::Add { name, url } => { diff --git a/crates/yt/src/update/mod.rs b/crates/yt/src/update/mod.rs index 11e70de..2fb1069 100644 --- a/crates/yt/src/update/mod.rs +++ b/crates/yt/src/update/mod.rs @@ -35,8 +35,6 @@ pub(crate) async fn update( app: &App, max_backlog: usize, subscription_names_to_update: Vec<String>, - total_number: Option<usize>, - current_progress: Option<usize>, ) -> Result<()> { let subscriptions = Subscriptions::get(app).await?; |