diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c928028f..b94df22e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/pipecat/pipeline/task.py b/src/pipecat/pipeline/task.py index 35d1971a5..185341b11 100644 --- a/src/pipecat/pipeline/task.py +++ b/src/pipecat/pipeline/task.py @@ -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.