From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2960576EB5 for ; Mon, 26 Apr 2021 10:21:12 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1F36212FA6 for ; Mon, 26 Apr 2021 10:21:12 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id A238F12F98 for ; Mon, 26 Apr 2021 10:21:07 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 7A06142640 for ; Mon, 26 Apr 2021 10:21:07 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Mon, 26 Apr 2021 10:21:05 +0200 Message-Id: <20210426082106.22024-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.000 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 1/2] server/jobstate: improve name of 'try_update_state_file' X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Apr 2021 08:21:12 -0000 and improve comment Signed-off-by: Dominik Csapak --- src/api2/config/sync.rs | 2 +- src/api2/config/tape_backup_job.rs | 2 +- src/api2/config/verify.rs | 2 +- src/server/jobstate.rs | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/api2/config/sync.rs b/src/api2/config/sync.rs index aa8369fd..e784029a 100644 --- a/src/api2/config/sync.rs +++ b/src/api2/config/sync.rs @@ -346,7 +346,7 @@ pub fn update_sync_job( sync::save_config(&config)?; if schedule_changed { - crate::server::jobstate::try_update_state_file("syncjob", &id)?; + crate::server::jobstate::update_job_last_run_time("syncjob", &id)?; } Ok(()) diff --git a/src/api2/config/tape_backup_job.rs b/src/api2/config/tape_backup_job.rs index 776b89e4..22afeb6d 100644 --- a/src/api2/config/tape_backup_job.rs +++ b/src/api2/config/tape_backup_job.rs @@ -283,7 +283,7 @@ 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)?; + crate::server::jobstate::update_job_last_run_time("tape-backup-job", &id)?; } Ok(()) diff --git a/src/api2/config/verify.rs b/src/api2/config/verify.rs index dee4c669..477cda89 100644 --- a/src/api2/config/verify.rs +++ b/src/api2/config/verify.rs @@ -282,7 +282,7 @@ pub fn update_verification_job( verify::save_config(&config)?; if schedule_changed { - crate::server::jobstate::try_update_state_file("verificationjob", &id)?; + crate::server::jobstate::update_job_last_run_time("verificationjob", &id)?; } Ok(()) diff --git a/src/server/jobstate.rs b/src/server/jobstate.rs index c62e58a2..30029bfd 100644 --- a/src/server/jobstate.rs +++ b/src/server/jobstate.rs @@ -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 -/// if the job is currently running, does nothing, -pub fn try_update_state_file(jobtype: &str, jobname: &str) -> Result<(), Error> { +/// if the job is currently running, does nothing. +/// 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) { Ok(job) => job, Err(_) => return Ok(()), // was locked (running), so do not update -- 2.20.1