Skip to content

Commit

Permalink
cleanup end channel
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Jul 17, 2024
1 parent b79039b commit 3f7c926
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/effect/src/internal/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,11 +638,12 @@ export const asyncPush = <A, E = never, R = never>(
),
(chunk) => {
const end = Chunk.unsafeLast(chunk) === emit.pushEOF
const items: Chunk.Chunk<A> = end ? Chunk.dropRight(chunk, 1) as any : chunk
if (end) {
return channel.zipRight(core.write(items), onEnd)
return chunk.length > 1
? channel.zipRight(core.write(Chunk.dropRight(chunk, 1) as Chunk.Chunk<A>), onEnd)
: onEnd
}
return channel.zipRight(core.write(items), loop)
return channel.zipRight(core.write(chunk as Chunk.Chunk<A>), loop)
}
)
return loop
Expand Down

0 comments on commit 3f7c926

Please sign in to comment.