server/jobstate: improve name of 'try_update_state_file'
and improve comment Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
951fe0cb7d
commit
37a634f550
|
@ -346,7 +346,7 @@ pub fn update_sync_job(
|
||||||
sync::save_config(&config)?;
|
sync::save_config(&config)?;
|
||||||
|
|
||||||
if schedule_changed {
|
if schedule_changed {
|
||||||
crate::server::jobstate::try_update_state_file("syncjob", &id)?;
|
crate::server::jobstate::update_job_last_run_time("syncjob", &id)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -283,7 +283,7 @@ pub fn update_tape_backup_job(
|
||||||
config::tape_job::save_config(&config)?;
|
config::tape_job::save_config(&config)?;
|
||||||
|
|
||||||
if schedule_changed {
|
if schedule_changed {
|
||||||
crate::server::jobstate::try_update_state_file("tape-backup-job", &id)?;
|
crate::server::jobstate::update_job_last_run_time("tape-backup-job", &id)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -282,7 +282,7 @@ pub fn update_verification_job(
|
||||||
verify::save_config(&config)?;
|
verify::save_config(&config)?;
|
||||||
|
|
||||||
if schedule_changed {
|
if schedule_changed {
|
||||||
crate::server::jobstate::try_update_state_file("verificationjob", &id)?;
|
crate::server::jobstate::update_job_last_run_time("verificationjob", &id)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -152,8 +152,9 @@ pub fn create_state_file(jobtype: &str, jobname: &str) -> Result<(), Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tries to update the state file with the current time
|
/// Tries to update the state file with the current time
|
||||||
/// if the job is currently running, does nothing,
|
/// if the job is currently running, does nothing.
|
||||||
pub fn try_update_state_file(jobtype: &str, jobname: &str) -> Result<(), Error> {
|
/// Intended for use when the schedule changes.
|
||||||
|
pub fn update_job_last_run_time(jobtype: &str, jobname: &str) -> Result<(), Error> {
|
||||||
let mut job = match Job::new(jobtype, jobname) {
|
let mut job = match Job::new(jobtype, jobname) {
|
||||||
Ok(job) => job,
|
Ok(job) => job,
|
||||||
Err(_) => return Ok(()), // was locked (running), so do not update
|
Err(_) => return Ok(()), // was locked (running), so do not update
|
||||||
|
|
Loading…
Reference in New Issue