Skip to content

Commit

Permalink
ensure Channel.mergeWith fibers can be interrupted
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Oct 31, 2024
1 parent 62d365d commit 5cb5cb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-actors-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

ensure Channel.mergeWith fibers can be interrupted
6 changes: 3 additions & 3 deletions packages/effect/src/internal/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ export const mergeWith = dual<
Effect.succeed(
core.flatMap(core.write(elem), () =>
core.flatMap(
core.fromEffect(Effect.forkDaemon(pull)),
core.fromEffect(Effect.forkIn(Effect.interruptible(pull), scope)),
(leftFiber) => go(both(leftFiber, fiber))
))
)
Expand Down Expand Up @@ -1807,8 +1807,8 @@ export const mergeWith = dual<
return pipe(
core.fromEffect(
Effect.zipWith(
Effect.forkIn(pullL, scope),
Effect.forkIn(pullR, scope),
Effect.forkIn(Effect.interruptible(pullL), scope),
Effect.forkIn(Effect.interruptible(pullR), scope),
(left, right): State =>
mergeState.BothRunning<
Env | Env1,
Expand Down

0 comments on commit 5cb5cb4

Please sign in to comment.