[elbe-devel] [PATCH 11/22] elbepack: projectmanager: avoid cache indirection in get_orig_fname()

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Aug 14 15:29:25 CEST 2024


The target project is already available, there is no need for the
indirection refetching it from the cache.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/daemons/soap/esoap.py | 4 +---
 elbepack/projectmanager.py     | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index f7c6bd012e72..5bb6ebf937a4 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -278,9 +278,7 @@ class ESoap (ServiceBase):
     @rpc(String, String)
     @authenticated_uid
     def append_upload_orig(self, uid, builddir, data):
-        self.app.pm.open_project(uid, builddir)
-
-        orig_fname = os.path.join(builddir, self.app.pm.get_orig_fname(uid))
+        orig_fname = os.path.join(builddir, self.app.pm.get_orig_fname(uid, builddir))
 
         # Now append to File
         fp = open(orig_fname, 'ab')
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 52c379eaa89c..631d2b01dd5e 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -223,9 +223,9 @@ class ProjectManager:
             ep.orig_fname = fname
             ep.orig_files.append(fname)
 
-    def get_orig_fname(self, userid):
+    def get_orig_fname(self, userid, builddir):
+        ep = self.open_project(userid, builddir, allow_busy=False)
         with self.lock:
-            ep = self._get_current_project(userid, allow_busy=False)
             if (not path.isdir(path.join(ep.builddir, 'pbuilder')) and
                     not path.isdir(path.join(ep.builddir, 'pbuilder_cross'))):
                 raise InvalidState('No pbuilder exists: run "elbe pbuilder '

-- 
2.46.0



More information about the elbe-devel mailing list