[pbs-devel] [PATCH proxmox-backup v3] api: make prune-group a real workertask
Stefan Lendl
s.lendl at proxmox.com
Tue Mar 12 11:30:52 CET 2024
LGTM with a slight note below for a style preference.
> + let prune_group = move |worker: Arc<WorkerTask>| {
> + if keep_all {
> + task_log!(worker, "No prune selection - keeping all files.");
> + } else {
You don't actually need to spawn a task if you're not doing any work.
On the other hand it makes the code slightly simpler and you need the
worker, right?
> + let mut opts = Vec::new();
> + if !ns.is_root() {
> + opts.push(format!("--ns {ns}"));
> + }
> + crate::server::cli_keep_options(&mut opts, &keep_options);
> +
> + task_log!(worker, "retention options: {}", opts.join(" "));
> + task_log!(
> + worker,
> + "Starting prune on {} group \"{}\"",
> + print_store_and_ns(&store, &ns),
> + group.group(),
> + );
> }
> - crate::server::cli_keep_options(&mut opts, &keep_options);
> -
> - task_log!(worker, "retention options: {}", opts.join(" "));
> - task_log!(
> - worker,
> - "Starting prune on {} group \"{}\"",
> - print_store_and_ns(&store, &ns),
> - group.group(),
> - );
> - }
>
> - for (info, mark) in prune_info {
> - let keep = keep_all || mark.keep();
> + for (info, mark) in prune_info {
> + let keep = keep_all || mark.keep();
> + let backup_dir = &info.backup_dir;
You wouldn't have to handle keep_all here.
You're handling dry_run separatly already as well.
More information about the pbs-devel
mailing list