mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
[PR #20910] [CLOSED] perf: unblock async event loop in pipelines router #41455
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20910
Author: @sjhddh
Created: 1/23/2026
Status: ❌ Closed
Base:
dev← Head:fix/pipelines-async-optimization📝 Commits (1)
eb7c979perf: unblock async event loop in pipelines router📊 Changes
1 file changed (+25 additions, -14 deletions)
View changed files
📝
backend/open_webui/routers/pipelines.py(+25 -14)📄 Description
Summary
Wrap synchronous
requestscalls withasyncio.to_thread()in the pipelines router to prevent blocking the FastAPI event loop during external pipeline API calls.Problem
The pipelines router uses synchronous
requestslibrary calls insideasync defendpoints. This blocks the entire Python event loop while waiting for external network I/O, preventing the server from handling other concurrent requests.Solution
Wrap all blocking
requests.get(),requests.post(), andrequests.delete()calls withawait asyncio.to_thread()to offload them to a thread pool. This allows the server to process other requests while waiting for pipeline operations to complete.Changed
requestscalls withasyncio.to_thread()in 7 endpoints:upload_pipelineadd_pipelinedelete_pipelineget_pipelinesget_pipeline_valvesget_pipeline_valves_specupdate_pipeline_valvesFixed
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.