task: allow queuing a CancelFrame to cancel the task
This commit is contained in:
@@ -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`
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user