fix(tongyi): use DashScope keepalive session pool - #3870
Merged
crazywoola merged 1 commit intoSep 11, 2026
Merged
Conversation
crazywoola
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #3815 and #3817.
DashScope confirmed that its process-wide shared synchronous session could
reuse silently stale pooled connections, causing requests to block until the
default 300-second read timeout. The underlying issue was fixed in
dashscope/dashscope-sdk-python#187 and released in
DashScope SDK 1.27.4.
Tongyi 0.2.19 already locks DashScope 1.27.4, but the embedding implementation
still creates a separate
requests.Sessionfor each invocation and passes itexplicitly to the SDK. This bypasses the SDK-managed shared session and its new
keepalive-enabled HTTP adapter.
This change removes explicit session creation and injection from:
Embedding requests now use the shared session managed by DashScope 1.27.4.
Existing batching, token accounting, connection-error retries, timeout
handling, and HTTP 429 handling remain unchanged.
The LLM and rerank implementations are not changed.
Release Notes
Use DashScope's keepalive-enabled shared connection pool for Tongyi text and
multimodal embedding requests, reducing the risk of long stalls caused by stale
idle connections.
Change Type
Screenshots / Videos
This is a backend connection-management change and has no user-interface
changes.
LLM Plugin Checklist
Areas affected by this change (check all that apply)
Version
versioninmanifest.yamlfrom0.2.19to0.2.20dify_plugin>=0.3.0,<0.6.0is declared inpyproject.tomland locked inuv.lockTesting
Validation performed:
uv.lockresolvesdashscope==1.27.4..difypkg.167 passed, 83 skipped.0.2.20-dev1validation package to two self-hostedplugin_daemonnodes.two hours of idle time, without reproducing the approximately 301-second stall.