From 2b8d2adfacd52e5e8fee740b0fb6c47f29ff5c03 Mon Sep 17 00:00:00 2001 From: Ethan Knox Date: Mon, 2 Dec 2024 13:31:13 -0500 Subject: [PATCH] singleton pattern --- letta/server/rest_api/app.py | 1 + letta/settings.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py index c8f2cdf044..0bfc9f91c9 100644 --- a/letta/server/rest_api/app.py +++ b/letta/server/rest_api/app.py @@ -182,6 +182,7 @@ def on_startup(): # Tool.load_default_tools(get_db_session()) generate_openapi_schema(app) + # always migrate now that we have a default in-memory postgres @app.on_event("shutdown") def on_shutdown(): diff --git a/letta/settings.py b/letta/settings.py index 3f558a3dc5..46e7eb2265 100644 --- a/letta/settings.py +++ b/letta/settings.py @@ -88,8 +88,8 @@ def letta_pg_uri(self) -> str: return f"postgresql+pg8000://{self.pg_user}:{self.pg_password}@{self.pg_host}:{self.pg_port}/{self.pg_db}" else: # start the pg binary. This is the default in-memory postgres that replaces SQLite/Chroma - db_uri = self.launch_pg_binary() - return db_uri + self.pg_uri = self.launch_pg_binary() + return self.pg_uri @property def letta_pg_uri_no_default(self) -> str: