Skip to content

fix(server): load .env before embedded-storage worker detectio#920

Open
Teingi wants to merge 9 commits intooceanbase:mainfrom
Teingi:dev_0507
Open

fix(server): load .env before embedded-storage worker detectio#920
Teingi wants to merge 9 commits intooceanbase:mainfrom
Teingi:dev_0507

Conversation

@Teingi
Copy link
Copy Markdown
Member

@Teingi Teingi commented May 7, 2026

image

用 .env 把向量库配成 OceanBase。OceanBaseConfig 配置了 env_file=None,不会去读 .env,只靠 os.environ。结果就是启动时出现:Embedded storage detected … Forcing workers=1,把本应可用的多 worker 强行改成 1。

@Teingi
Copy link
Copy Markdown
Member Author

Teingi commented May 7, 2026

修复方案

  • 在 _is_embedded_storage() 里,先调用 _load_dotenv_if_available(),把项目 .env(或 POWERMEM_ENV_FILE 指向的文件)加载进 os.environ。
  • 再构造 DatabaseSettings() 和 OceanBaseConfig(),用真实的 provider 和 是否有远程 host 来判断是否为嵌入式,从而 只在真的是 SQLite / 本地 SeekDB(host 为空)时才强制 workers=1。

Fix

  • In _is_embedded_storage(), first call _load_dotenv_if_available() to load the project .env (or the file pointed to by POWERMEM_ENV_FILE) into os.environ.
  • Reconstruct DatabaseSettings() and OceanBaseConfig(), use the real provider and whether there is a remote host to determine whether it is embedded, so that workers=1 is only forced when it is really SQLite/local SeekDB (host is empty).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant