task: allow queuing a CancelFrame to cancel the task

This commit is contained in:
Aleix Conchillo Flaqué
2025-01-28 15:51:22 -08:00
parent 3fe2124314
commit 0547a15695
2 changed files with 5 additions and 1 deletions

View File

@@ -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.