public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup v2 1/2] proxy: fix error handling in prune scheduling
@ 2020-09-24 14:13 Dominik Csapak
  2020-09-24 14:13 ` [pbs-devel] [PATCH proxmox-backup v2 2/2] use jobstate mechanism for verify/garbage_collection schedules Dominik Csapak
  2020-09-24 15:06 ` [pbs-devel] applied: [PATCH proxmox-backup v2 1/2] proxy: fix error handling in prune scheduling Dietmar Maurer
  0 siblings, 2 replies; 4+ messages in thread
From: Dominik Csapak @ 2020-09-24 14:13 UTC (permalink / raw)
  To: pbs-devel

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 use our try_block! macro that wraps the code in a closure

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* use try_block instead of closure
 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..b4759f58 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 = try_block!({
 
                     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);
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-24 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 14:13 [pbs-devel] [PATCH proxmox-backup v2 1/2] proxy: fix error handling in prune scheduling Dominik Csapak
2020-09-24 14:13 ` [pbs-devel] [PATCH proxmox-backup v2 2/2] use jobstate mechanism for verify/garbage_collection schedules Dominik Csapak
2020-09-24 15:07   ` [pbs-devel] applied: " Dietmar Maurer
2020-09-24 15:06 ` [pbs-devel] applied: [PATCH proxmox-backup v2 1/2] proxy: fix error handling in prune scheduling Dietmar Maurer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal