PipelineTask: avoid cancellation if application is finished

This commit is contained in:
Aleix Conchillo Flaqué
2025-09-30 13:18:25 -07:00
parent 55c321f4ff
commit e79c4fc99d
2 changed files with 6 additions and 4 deletions

View File

@@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Fixed
- Fixed a `PipelineTask` issue that could prevent the application to exit if
`task.cancel()` was called when the task was already finished.
- Fixed an issue where local SmartTurn was not being ran in a separate thread.
## [0.0.86] - 2025-09-24

View File

@@ -13,8 +13,7 @@ including heartbeats, idle detection, and observer integration.
import asyncio
import time
from collections import deque
from typing import Any, AsyncIterable, Deque, Dict, Iterable, List, Optional, Tuple, Type
from typing import Any, AsyncIterable, Dict, Iterable, List, Optional, Tuple, Type
from loguru import logger
from pydantic import BaseModel, ConfigDict, Field
@@ -31,7 +30,6 @@ from pipecat.frames.frames import (
ErrorFrame,
Frame,
HeartbeatFrame,
InputAudioRawFrame,
InterruptionFrame,
InterruptionTaskFrame,
MetricsFrame,
@@ -395,7 +393,8 @@ class PipelineTask(BasePipelineTask):
Cancels all running tasks and stops frame processing without
waiting for completion.
"""
await self._cancel()
if not self._finished:
await self._cancel()
async def run(self, params: PipelineTaskParams):
"""Start and manage the pipeline execution until completion or cancellation.