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
- 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. - Fixed an issue where local SmartTurn was not being ran in a separate thread.
## [0.0.86] - 2025-09-24 ## [0.0.86] - 2025-09-24

View File

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