From: Stefan Reiter <s.reiter@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/2] proxy: fix error handling in prune scheduling
Date: Thu, 24 Sep 2020 16:01:13 +0200 [thread overview]
Message-ID: <b15afe05-9a85-6ff7-1f6f-482330fff275@proxmox.com> (raw)
In-Reply-To: <20200924135226.30186-1-d.csapak@proxmox.com>
On 9/24/20 3:52 PM, Dominik Csapak wrote:
> we rely on the jobstate handling to write the error of the worker
> into its state file, but we used '?' here in a block which does not
> return the error to the block, but to the function/closure instead
>
> so if a prune job failed because of such an '?', we did not write
> into the statefile and got a wrong state there
>
> instead execute the code in a closure where the error gets returned
> correctly
>
> in the future, we can use 'try blocks' (currently not in stable)
>
Don't we also have the proxmox::try_block! macro? What's the difference
to that then?
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> src/bin/proxmox-backup-proxy.rs | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
> index 8a6dfe36..96001214 100644
> --- a/src/bin/proxmox-backup-proxy.rs
> +++ b/src/bin/proxmox-backup-proxy.rs
> @@ -434,7 +434,7 @@ async fn schedule_datastore_prune() {
>
> job.start(&worker.upid().to_string())?;
>
> - let result = {
> + let result = (|| {
>
> worker.log(format!("Starting datastore prune on store \"{}\"", store));
> worker.log(format!("task triggered by schedule '{}'", event_str));
> @@ -463,7 +463,7 @@ async fn schedule_datastore_prune() {
> }
> }
> Ok(())
> - };
> + })();
>
> let status = worker.create_state(&result);
>
>
next prev parent reply other threads:[~2020-09-24 14:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 13:52 Dominik Csapak
2020-09-24 13:52 ` [pbs-devel] [PATCH proxmox-backup 2/2] use jobstate mechanism for verify/garbage_collection schedules Dominik Csapak
2020-09-24 14:01 ` Stefan Reiter [this message]
2020-09-24 14:04 ` [pbs-devel] [PATCH proxmox-backup 1/2] proxy: fix error handling in prune scheduling Dominik Csapak
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=b15afe05-9a85-6ff7-1f6f-482330fff275@proxmox.com \
--to=s.reiter@proxmox.com \
--cc=d.csapak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox