Skip to content

Commit c09f32d

Browse files
author
yuan.wang
committed
Merge remote-tracking branch 'upstream/dev-20260302-v2.0.8' into feat/transfer_pref_to_polar_db
2 parents a3db719 + 1062fec commit c09f32d

File tree

3 files changed

+467
-705
lines changed

3 files changed

+467
-705
lines changed

src/memos/api/config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,17 @@ def get_polardb_config(user_id: str | None = None) -> dict[str, Any]:
675675
"user_name": user_name,
676676
"use_multi_db": use_multi_db,
677677
"auto_create": True,
678-
"embedding_dimension": int(os.getenv("EMBEDDING_DIMENSION", 1024)),
678+
"embedding_dimension": int(os.getenv("EMBEDDING_DIMENSION", "1024")),
679+
# .env: CONNECTION_WAIT_TIMEOUT, SKIP_CONNECTION_HEALTH_CHECK, WARM_UP_ON_STARTUP_BY_FULL, WARM_UP_ON_STARTUP_BY_ALL
680+
"connection_wait_timeout": int(os.getenv("CONNECTION_WAIT_TIMEOUT", "60")),
681+
"skip_connection_health_check": os.getenv(
682+
"SKIP_CONNECTION_HEALTH_CHECK", "false"
683+
).lower()
684+
== "true",
685+
"warm_up_on_startup_by_full": os.getenv("WARM_UP_ON_STARTUP_BY_FULL", "false").lower()
686+
== "true",
687+
"warm_up_on_startup_by_all": os.getenv("WARM_UP_ON_STARTUP_BY_ALL", "false").lower()
688+
== "true",
679689
}
680690

681691
@staticmethod

src/memos/configs/graph_db.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,33 @@ class PolarDBGraphDBConfig(BaseConfig):
202202
default=100,
203203
description="Maximum number of connections in the connection pool",
204204
)
205+
connection_wait_timeout: int = Field(
206+
default=30,
207+
ge=1,
208+
le=3600,
209+
description="Max seconds to wait for a connection slot before raising (0 = wait forever, not recommended)",
210+
)
211+
skip_connection_health_check: bool = Field(
212+
default=False,
213+
description=(
214+
"If True, skip SELECT 1 health check when getting connections (~1-2ms saved per request). "
215+
"Use only when pool/network is reliable."
216+
),
217+
)
218+
warm_up_on_startup_by_full: bool = Field(
219+
default=True,
220+
description=(
221+
"If True, run search_by_fulltext warm-up on pool connections at init to reduce "
222+
"first-query latency (~200ms planning). Requires user_name in config."
223+
),
224+
)
225+
warm_up_on_startup_by_all: bool = Field(
226+
default=False,
227+
description=(
228+
"If True, run all connection warm-up on pool connections at init to reduce "
229+
"first-query latency (~200ms planning). Requires user_name in config."
230+
),
231+
)
205232

206233
@model_validator(mode="after")
207234
def validate_config(self):

0 commit comments

Comments
 (0)