From 0e1edf19b1c3f4e68e1340b340a6c655846ce095 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 7 Oct 2021 14:03:37 +0200 Subject: [PATCH] proxmox-backup-proxy: clean up old tasks when the task log was rotated we maybe have old tasks when the task list was rotated, so clean them up Signed-off-by: Dominik Csapak --- src/bin/proxmox-backup-proxy.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index 9199ebae..4c879483 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -22,13 +22,13 @@ use proxmox::api::{RpcEnvironment, RpcEnvironmentType, UserInformation}; use proxmox::sys::linux::socket::set_tcp_keepalive; use proxmox::tools::fs::CreateOptions; -use pbs_tools::task_log; +use pbs_tools::{task_log, task_warn}; use pbs_datastore::DataStore; use proxmox_rrd::DST; use proxmox_rest_server::{ rotate_task_log_archive, extract_cookie , AuthError, ApiConfig, RestServer, RestEnvironment, - ServerAdapter, WorkerTask, + ServerAdapter, WorkerTask, cleanup_old_tasks, }; use proxmox_backup::{ @@ -827,6 +827,13 @@ async fn schedule_task_log_rotate() { task_log!(worker, "API authentication log was not rotated"); } + if has_rotated { + task_log!(worker, "cleaning up old task logs"); + if let Err(err) = cleanup_old_tasks(true) { + task_warn!(worker, "could not completely cleanup old tasks: {}", err); + } + } + Ok(()) });