add custom asyncio.wait_for()

This patch uses `wait_for2` package to implement `asyncio.wait_for()` for
Python < 3.12.

In Python 3.12, `asyncio.wait_for()` is implemented in terms of
`asyncio.timeout()` which fixed a bunch of issues. However, this was never
backported (because of the lack of `async.timeout()`) and there are still many
remainig issues, specially in Python 3.10, in `async.wait_for()`.

See https://github.com/python/cpython/pull/98518
This commit is contained in:
Aleix Conchillo Flaqué
2025-08-20 10:58:09 -07:00
parent 5286591826
commit f387776985
31 changed files with 119 additions and 53 deletions

View File

@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added `pipecat.utils.timeout.wait_for()` which uses `wait_for2` package to
avoid `asyncio.wait_for()` issues in Python < 3.12.
- Allow passing custom pipeline sink and source processors to a
`Pipeline`. Pipeline source and sink processors are used to know and control
what's coming in and out of a `Pipeline` processor.
@@ -46,6 +49,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Replaced `asyncio.wait_for()` for Pipecat's `wait_for()`. In Python 3.10,
`asyncio.wait_for()` has issues regarding task cancellation (i.e. cancellation
is never propagated).
See https://bugs.python.org/issue42130
- Fixed an `AudioBufferProcessor` issues that would cause audio overlap when
setting a max buffer size.