proxy: fix error handling in prune scheduling

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>
This commit is contained in:
Dominik Csapak 2020-09-24 16:13:53 +02:00 committed by Dietmar Maurer
parent 17a1f579d0
commit 6c25588e63

View File

@ -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);