From 59e238b3f997282560536f81ef265bec63dc1caf Mon Sep 17 00:00:00 2001 From: Wei Ouyang Date: Sun, 18 Aug 2024 03:52:12 -0700 Subject: [PATCH] Fix workspace check --- hypha/core/workspace.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hypha/core/workspace.py b/hypha/core/workspace.py index b7d758dd..f242c19e 100644 --- a/hypha/core/workspace.py +++ b/hypha/core/workspace.py @@ -187,9 +187,12 @@ async def create_workspace( user_info = UserInfo.model_validate(context["user"]) if user_info.is_anonymous: raise Exception("Only registered user can create workspace.") - if await self._redis.hexists("workspace", config["name"]): - if not overwrite: - raise KeyError(f"Workspace already exists: {ws}") + try: + if await self.load_workspace_info(ws): + if not overwrite: + raise KeyError(f"Workspace already exists: {ws}") + except KeyError: + pass config["persistent"] = config.get("persistent") or False if user_info.is_anonymous and config["persistent"]: