[elbe-devel] [PATCH 18/22] elbepack: projectmanager: avoid cache indirection in project_is_busy()
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Wed Aug 14 15:29:32 CEST 2024
The target project is already available, there is no need for the
indirection refetching it from the cache.
Avoid calling open_project() as that invokes the ElbeProject constructor
which has sideeffects. These sideeffects break when called concurrently
with another constructor, but the whole point of project_is_busy() is to
be called concurrently.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/daemons/soap/esoap.py | 3 +--
elbepack/projectmanager.py | 9 +++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index dbd5fcf5964a..5728473ea40d 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -319,8 +319,7 @@ class ESoap (ServiceBase):
@rpc(String, _returns=String)
@authenticated_uid
def get_project_busy(self, uid, builddir):
- self.app.pm.open_project(uid, builddir)
- ret, msg = self.app.pm.current_project_is_busy(uid)
+ ret, msg = self.app.pm.project_is_busy(uid, builddir)
if not msg and not ret:
return 'ELBE-FINISH'
return msg
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 269cdd82cab5..a75ecbc152d0 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -287,11 +287,12 @@ class ProjectManager:
ep.repo.finalize()
- def current_project_is_busy(self, userid):
+ def project_is_busy(self, userid, builddir):
+ self._check_project_permission(userid, builddir)
+
with self.lock:
- ep = self._get_current_project(userid)
- msg = read_loggingQ(ep.builddir)
- return self.db.is_busy(ep.builddir), msg
+ msg = read_loggingQ(builddir)
+ return self.db.is_busy(builddir), msg
def _get_current_project(self, userid, allow_busy=True):
# Must be called with self.lock held
--
2.46.0
More information about the elbe-devel
mailing list