Wrap synchronous requests calls with asyncio.to_thread() in the pipelines router to prevent blocking the FastAPI event loop during external pipeline API calls.
Problem
The pipelines router uses synchronous requests library calls inside async def endpoints. 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(), and requests.delete() calls with await 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
Wrapped blocking requests calls with asyncio.to_thread() in 7 endpoints:
upload_pipeline
add_pipeline
delete_pipeline
get_pipelines
get_pipeline_valves
get_pipeline_valves_spec
update_pipeline_valves
Fixed
Event loop blocking during external pipeline API calls
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.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/20910
**Author:** [@sjhddh](https://github.com/sjhddh)
**Created:** 1/23/2026
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `fix/pipelines-async-optimization`
---
### 📝 Commits (1)
- [`eb7c979`](https://github.com/open-webui/open-webui/commit/eb7c9794c9dd5184b8cfc3c14df7651d6ab19038) perf: unblock async event loop in pipelines router
### 📊 Changes
**1 file changed** (+25 additions, -14 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/routers/pipelines.py` (+25 -14)
</details>
### 📄 Description
## Summary
Wrap synchronous `requests` calls with `asyncio.to_thread()` in the pipelines router to prevent blocking the FastAPI event loop during external pipeline API calls.
## Problem
The pipelines router uses synchronous `requests` library calls inside `async def` endpoints. 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()`, and `requests.delete()` calls with `await 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
- Wrapped blocking `requests` calls with `asyncio.to_thread()` in 7 endpoints:
- `upload_pipeline`
- `add_pipeline`
- `delete_pipeline`
- `get_pipelines`
- `get_pipeline_valves`
- `get_pipeline_valves_spec`
- `update_pipeline_valves`
### Fixed
- Event loop blocking during external pipeline API calls
---
### Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 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.