From 00a573f6013b1ee7a4d222156dd03d8d26f51460 Mon Sep 17 00:00:00 2001 From: Eva Bardou <ebardou@teklia.com> Date: Thu, 25 Mar 2021 15:30:39 +0100 Subject: [PATCH] Add comments --- arkindex_worker/worker.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arkindex_worker/worker.py b/arkindex_worker/worker.py index c2a92191..26b85048 100644 --- a/arkindex_worker/worker.py +++ b/arkindex_worker/worker.py @@ -141,12 +141,14 @@ class BaseWorker(object): if os.path.isfile(parent_cache_path): parents_cache_paths.append(parent_cache_path) + # Only one parent cache, we can just copy it into our current task local cache if len(parents_cache_paths) == 1: with open(self.cache.path, "rb+") as cache_file, open( parents_cache_paths[0], "rb" ) as parent_cache_file: cache_file.truncate(0) cache_file.write(parent_cache_file.read()) + # Many parents caches, we have to merge all of them in our current task local cache elif len(parents_cache_paths) > 1: self.cache.merge_parent_caches(parents_cache_paths) -- GitLab