[elbe-devel] [PATCH 02/22] elbepack: projectmanager: return opened project

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


Many callers first open the project only to immediately fetch it from
the cache. Return the opened project directly from open_project() so
this additional step is not necessary.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/projectmanager.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index 8bb8aa8d3ee6..81961f5801ab 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -111,7 +111,7 @@ class ProjectManager:
                 if self.builddir2userid[builddir] == userid:
                     # Same project selected again by the same user, don't do
                     # anything
-                    return
+                    return self.userid2project[userid]
 
                 # Already opened by a different user
                 raise AlreadyOpen(builddir,
@@ -128,6 +128,8 @@ class ProjectManager:
             self.userid2project[userid] = ep
             self.builddir2userid[builddir] = userid
 
+            return ep
+
     def close_current_project(self, userid):
         with self.lock:
             self._close_current_project(userid)

-- 
2.46.0



More information about the elbe-devel mailing list