Skip to content

fix(provider-test): 修复测试供应商配置时 DetachedInstanceError - #270

Merged
fawney19 merged 1 commit into
fawney19:masterfrom
y49:fix/detached-instance-error-in-provider-test
Apr 17, 2026
Merged

fawney19 merged 1 commit into
fawney19:masterfrom
y49:fix/detached-instance-error-in-provider-test

Conversation

@y49

@y49 y49 commented Mar 31, 2026

Copy link
Copy Markdown

两处修复:

  1. endpoint_checker.py: 移除 asyncio.to_thread 包装同步 DB 查询, 避免跨线程导致 SQLAlchemy Session 失效

  2. provider_query.py: 并发测试预加载 ProviderEndpoint 和 ProviderAPIKey 时 添加 joinedload(provider),确保 expunge 后不会触发懒加载

两处修复:

1. endpoint_checker.py: 移除 asyncio.to_thread 包装同步 DB 查询,
   避免跨线程导致 SQLAlchemy Session 失效

2. provider_query.py: 并发测试预加载 ProviderEndpoint 和 ProviderAPIKey 时
   添加 joinedload(provider),确保 expunge 后不会触发懒加载
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.

2 participants