diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index 87be8f3e..c946c20c 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -14,10 +14,10 @@ use proxmox_backup::api2::types::Userid; use proxmox_backup::configdir; use proxmox_backup::buildcfg; use proxmox_backup::server; -use proxmox_backup::tools::daemon; use proxmox_backup::server::{ApiConfig, rest::*}; use proxmox_backup::auth_helpers::*; use proxmox_backup::tools::{ + daemon, disks::{ DiskManage, zfs_pool_stats, @@ -739,10 +739,11 @@ async fn schedule_task_log_rotate() { move |worker| { job.start(&worker.upid().to_string())?; worker.log(format!("starting task log rotation")); - // one entry has normally about ~100-150 bytes - let max_size = 500000; // at least 5000 entries - let max_files = 20; // at least 100000 entries + let result = try_block!({ + // rotate task log archive + let max_size = 500000; // a normal entry has about 100b, so ~ 5000 entries/file + let max_files = 20; // times twenty files gives at least 100000 task entries let has_rotated = rotate_task_log_archive(max_size, true, Some(max_files))?; if has_rotated { worker.log(format!("task log archive was rotated")); diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs index ab362aca..ab8e2bf6 100644 --- a/src/server/worker_task.rs +++ b/src/server/worker_task.rs @@ -93,22 +93,27 @@ pub fn create_task_control_socket() -> Result<(), Error> { "\0{}/proxmox-task-control-{}.sock", PROXMOX_BACKUP_VAR_RUN_DIR, *MY_PID); let control_future = super::create_control_socket(socketname, |param| { - let param = param.as_object() + let param = param + .as_object() .ok_or_else(|| format_err!("unable to parse parameters (expected json object)"))?; if param.keys().count() != 2 { bail!("wrong number of parameters"); } - let command = param["command"].as_str() + let command = param["command"] + .as_str() .ok_or_else(|| format_err!("unable to parse parameters (missing command)"))?; // we have only two commands for now - if !(command == "abort-task" || command == "status") { bail!("got unknown command '{}'", command); } + if !(command == "abort-task" || command == "status") { + bail!("got unknown command '{}'", command); + } - let upid_str = param["upid"].as_str() + let upid_str = param["upid"] + .as_str() .ok_or_else(|| format_err!("unable to parse parameters (missing upid)"))?; let upid = upid_str.parse::()?; - if !((upid.pid == *MY_PID) && (upid.pstart == *MY_PID_PSTART)) { + if !(upid.pid == *MY_PID && upid.pstart == *MY_PID_PSTART) { bail!("upid does not belong to this process"); } @@ -560,7 +565,8 @@ impl TaskListInfoIterator { let archive = if active_only { None } else { - let logrotate = LogRotate::new(PROXMOX_BACKUP_ARCHIVE_TASK_FN, true).ok_or_else(|| format_err!("could not get archive file names"))?; + let logrotate = LogRotate::new(PROXMOX_BACKUP_ARCHIVE_TASK_FN, true) + .ok_or_else(|| format_err!("could not get archive file names"))?; Some(logrotate.files()) };