From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Hannes Laimer <h.laimer@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-backup v2 1/5] api2: make Remote for SyncJob optional
Date: Tue, 28 Feb 2023 10:41:22 +0100 [thread overview]
Message-ID: <20230228094122.wkjchjyqlsf5u5kb@casey.proxmox.com> (raw)
In-Reply-To: <20230223125540.1298442-2-h.laimer@proxmox.com>
Just minor things.
On Thu, Feb 23, 2023 at 01:55:36PM +0100, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
> pbs-api-types/src/jobs.rs | 4 +-
> src/api2/config/remote.rs | 2 +-
> src/api2/config/sync.rs | 41 +++++++++++++------
> src/api2/node/tasks.rs | 4 +-
> src/api2/pull.rs | 68 +++++++++++++++++++++++--------
> src/server/email_notifications.rs | 16 ++++----
> 6 files changed, 93 insertions(+), 42 deletions(-)
>
> diff --git a/src/api2/pull.rs b/src/api2/pull.rs
> index b2473ec8..bb8f6fe1 100644
> --- a/src/api2/pull.rs
> +++ b/src/api2/pull.rs
> @@ -64,7 +75,7 @@ impl TryFrom<&SyncJobConfig> for PullParameters {
> PullParameters::new(
> &sync_job.store,
> sync_job.ns.clone().unwrap_or_default(),
> - &sync_job.remote,
> + sync_job.remote.clone().as_deref(),
^ unnecessary .clone()
> &sync_job.remote_store,
> sync_job.remote_ns.clone().unwrap_or_default(),
> sync_job
> @@ -75,7 +86,6 @@ impl TryFrom<&SyncJobConfig> for PullParameters {
> sync_job.remove_vanished,
> sync_job.max_depth,
> sync_job.group_filter.clone(),
> - sync_job.limit.clone(),
> )
> }
> }
> diff --git a/src/server/email_notifications.rs b/src/server/email_notifications.rs
> index b3298cf9..31a46b0f 100644
> --- a/src/server/email_notifications.rs
> +++ b/src/server/email_notifications.rs
> @@ -486,15 +486,15 @@ pub fn send_sync_status(
> }
> };
>
You can declare a binding here to:
let tmp_src_string;
> + let source_str = if let Some(remote) = job.remote.clone() {
You can borrow here instead of cloning.
> + format!("Sync remote '{}'", remote)
You can assign `tmp_src_string` here, and return &tmp_src_string from
the block. (and remote can go into the `{}` portion)
let tmp_src_string = format!("Sync remote '{remote}'");
&tmp_src_string
> + } else {
> + format!("Sync local")
And drop the `format!()` here altogether and just use "Sync local".
With the `tmp_src_string` being outside the `if` scope this will allow
the string w/o a remote to just reference the `&'static str` instead of
allocating.
> + };
> +
> let subject = match result {
> - Ok(()) => format!(
> - "Sync remote '{}' datastore '{}' successful",
> - job.remote, job.remote_store,
> - ),
> - Err(_) => format!(
> - "Sync remote '{}' datastore '{}' failed",
> - job.remote, job.remote_store,
> - ),
> + Ok(()) => format!("{} datastore '{}' successful", source_str, job.remote_store,),
> + Err(_) => format!("{} datastore '{}' failed", source_str, job.remote_store,),
> };
>
> send_job_status_mail(email, &subject, &text)?;
> --
> 2.30.2
next prev parent reply other threads:[~2023-02-28 9:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 12:55 [pbs-devel] [PATCH proxmox-backup v2 0/5] local sync-jobs Hannes Laimer
2023-02-23 12:55 ` [pbs-devel] [PATCH proxmox-backup v2 1/5] api2: make Remote for SyncJob optional Hannes Laimer
2023-02-28 9:41 ` Wolfgang Bumiller [this message]
2023-02-28 11:35 ` Fabian Grünbichler
2023-02-23 12:55 ` [pbs-devel] [PATCH proxmox-backup v2 2/5] ui: add support for optional Remote in SyncJob Hannes Laimer
2023-02-23 12:55 ` [pbs-devel] [PATCH proxmox-backup v2 3/5] manager: add completion for opt. " Hannes Laimer
2023-02-23 12:55 ` [pbs-devel] [PATCH proxmox-backup v2 4/5] pbs-client: accept a ref to a HttpClient in BackupReader::starting Hannes Laimer
2023-02-28 11:35 ` Fabian Grünbichler
2023-02-23 12:55 ` [pbs-devel] [PATCH proxmox-backup v2 5/5] pull: add support for local pulling Hannes Laimer
2023-02-28 11:25 ` Wolfgang Bumiller
2023-02-28 11:36 ` Fabian Grünbichler
2023-02-28 11:35 ` [pbs-devel] [PATCH proxmox-backup v2 0/5] local sync-jobs Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230228094122.wkjchjyqlsf5u5kb@casey.proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=h.laimer@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.