server/jobstate: add 'updatd' to Finish variant
when a user updates a job schedule, we want to save that point in time to calculate future runs, otherwise when a user updates a schedule to a time that would have been between the last run and 'now' the schedule is triggered instantly for example: schedule 08:00 last run today 08:00 now it is 12:00 before this patch: update schedule to 11:00 -> triggered instantly since we calculate from 08:00 after this patch: update schedule to 11:00 -> triggered tomorrow 11:00 since we calculate from today 12:00 the change in the enum type is ok, since by default serde does not error on unknown fields and the new field is optional Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
4ca3f0c6ae
commit
951fe0cb7d
@ -333,6 +333,7 @@ pub fn update_sync_job(
|
||||
if let Some(remote_store) = remote_store { data.remote_store = remote_store; }
|
||||
if let Some(owner) = owner { data.owner = Some(owner); }
|
||||
|
||||
let schedule_changed = data.schedule != schedule;
|
||||
if schedule.is_some() { data.schedule = schedule; }
|
||||
if remove_vanished.is_some() { data.remove_vanished = remove_vanished; }
|
||||
|
||||
@ -344,6 +345,10 @@ pub fn update_sync_job(
|
||||
|
||||
sync::save_config(&config)?;
|
||||
|
||||
if schedule_changed {
|
||||
crate::server::jobstate::try_update_state_file("syncjob", &id)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -266,6 +266,7 @@ pub fn update_tape_backup_job(
|
||||
if latest_only.is_some() { data.setup.latest_only = latest_only; }
|
||||
if notify_user.is_some() { data.setup.notify_user = notify_user; }
|
||||
|
||||
let schedule_changed = data.schedule != schedule;
|
||||
if schedule.is_some() { data.schedule = schedule; }
|
||||
|
||||
if let Some(comment) = comment {
|
||||
@ -281,6 +282,10 @@ pub fn update_tape_backup_job(
|
||||
|
||||
config::tape_job::save_config(&config)?;
|
||||
|
||||
if schedule_changed {
|
||||
crate::server::jobstate::try_update_state_file("tape-backup-job", &id)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -274,12 +274,17 @@ pub fn update_verification_job(
|
||||
|
||||
if ignore_verified.is_some() { data.ignore_verified = ignore_verified; }
|
||||
if outdated_after.is_some() { data.outdated_after = outdated_after; }
|
||||
let schedule_changed = data.schedule != schedule;
|
||||
if schedule.is_some() { data.schedule = schedule; }
|
||||
|
||||
config.set_data(&id, "verification", &data)?;
|
||||
|
||||
verify::save_config(&config)?;
|
||||
|
||||
if schedule_changed {
|
||||
crate::server::jobstate::try_update_state_file("verificationjob", &id)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user