First cut at sample 6 rewrite with pipelines

This commit is contained in:
Moishe Lettvin
2024-03-04 07:28:10 -05:00
parent 3b282cc921
commit 763a50f8ec
3 changed files with 30 additions and 21 deletions

View File

@@ -39,12 +39,12 @@ class Pipeline:
for frame_generator in frame_generators:
async for frame in frame_generator:
await self.sink.put(frame)
if isinstance(
frame, EndStreamQueueFrame
) or isinstance(
frame, EndParallelPipeQueueFrame
):
return
if isinstance(
frame, EndStreamQueueFrame
) or isinstance(
frame, EndParallelPipeQueueFrame
):
return
except asyncio.CancelledError:
# this means there's been an interruption, do any cleanup necessary here.
for processor in self.processors: