]> git.proxmox.com Git - proxmox.git/commitdiff
rest-server: code complexity clean-up in task-log rotation
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 18 Oct 2023 17:41:55 +0000 (19:41 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 26 Oct 2023 08:13:45 +0000 (10:13 +0200)
avoid using the negative in the if check and extract the value to be
passed upfront.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
proxmox-rest-server/src/worker_task.rs

index fd052c8a238851987f7a43b24e49bc7c38609b21..c0b99b78401323ccc40781f15715825331b2950d 100644 (file)
@@ -251,12 +251,9 @@ pub fn rotate_task_log_archive(
 
     let _lock = setup.lock_task_list_files(true)?;
 
-    let mut logrotate = LogRotate::new(
-        &setup.task_archive_fn,
-        compress,
-        if max_days.is_none() { max_files } else { None },
-        options,
-    )?;
+    let max_files = if max_days.is_some() { None } else { max_files };
+
+    let mut logrotate = LogRotate::new(&setup.task_archive_fn, compress, max_files, options)?;
 
     let mut rotated = logrotate.rotate(size_threshold)?;