diff --git a/CHANGELOG.md b/CHANGELOG.md index 46ac58a8c..0e324c463 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a `PipelineTask` issue that was preventing processors to be cleaned up after cancelling the task. +- Fixed an issue where queuing a `CancelFrame` to a pipeline task would not + cause the task to finish. However, using `PipelineTask.cancel()` is still the + recommended way to cancel a task. + ### Other - Updated all examples to use `task.cancel()` instead of pushing an `EndFrame` diff --git a/src/pipecat/pipeline/task.py b/src/pipecat/pipeline/task.py index 9f59e8177..b862583ef 100644 --- a/src/pipecat/pipeline/task.py +++ b/src/pipecat/pipeline/task.py @@ -279,7 +279,7 @@ class PipelineTask(BaseTask): await self._source.queue_frame(frame, FrameDirection.DOWNSTREAM) if isinstance(frame, EndFrame): await self._wait_for_endframe() - running = not isinstance(frame, (StopTaskFrame, EndFrame)) + running = not isinstance(frame, (CancelFrame, EndFrame, StopTaskFrame)) should_cleanup = not isinstance(frame, StopTaskFrame) self._push_queue.task_done() # Cleanup only if we need to.