[pdm-devel] [PATCH proxmox-datacenter-manager v7 6/7] remote tasks: task cache: create `active` file in init

Lukas Wagner l.wagner at proxmox.com
Wed Aug 20 14:43:28 CEST 2025


This avoids a 'could not create task archive iterator' error before the
first round of task fetching.

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---

Notes:
    New in v7

 server/src/remote_tasks/task_cache.rs | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/server/src/remote_tasks/task_cache.rs b/server/src/remote_tasks/task_cache.rs
index 9e6a65cd..1afeaee4 100644
--- a/server/src/remote_tasks/task_cache.rs
+++ b/server/src/remote_tasks/task_cache.rs
@@ -214,11 +214,24 @@ impl ReadableTaskCache {
 }
 
 impl WritableTaskCache {
-    /// Create initial task archives that can be backfilled with the
+    /// Create initial task archive files that can be backfilled with the
     /// recent task history from a remote.
     ///
     /// This function only has an effect if there are no archive files yet.
     pub fn init(&self, now: i64) -> Result<(), Error> {
+        let active_filename = self.cache.base_path.join(ACTIVE_FILENAME);
+
+        if !active_filename.exists() {
+            let mut file = OpenOptions::new()
+                .create(true)
+                .write(true)
+                .open(&active_filename)?;
+
+            self.cache
+                .create_options
+                .apply_to(&mut file, &active_filename)?;
+        }
+
         if self.cache.archive_files(&self.lock)?.is_empty() {
             for i in 0..self.cache.max_files {
                 self.new_file(
-- 
2.47.2





More information about the pdm-devel mailing list