Skip to content

Commit 2a50043

Browse files
committed
prevent worker handler interrupts from shutting down runner
1 parent fe7da20 commit 2a50043

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.changeset/dull-seas-share.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@effect/platform-browser": patch
3+
"@effect/platform-node": patch
4+
"@effect/platform-bun": patch
5+
---
6+
7+
prevent worker handler interrupts from shutting down runner

packages/platform-browser/src/internal/workerRunner.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const make = (self: MessagePort | Window) =>
4545
const fiberSet = yield* FiberSet.make<any, WorkerError | E>()
4646
const runFork = Runtime.runFork(runtime)
4747
function onExit(exit: Exit.Exit<any, E>) {
48-
if (exit._tag === "Failure") {
48+
if (exit._tag === "Failure" && !Cause.isInterruptedOnly(exit.cause)) {
4949
Deferred.unsafeDone(closeLatch, Exit.die(Cause.squash(exit.cause)))
5050
}
5151
}

packages/platform-bun/src/internal/workerRunner.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const platformRunnerImpl = Runner.PlatformRunner.of({
3030
const fiberSet = yield* FiberSet.make<any, WorkerError | E>()
3131
const runFork = Runtime.runFork(runtime)
3232
const onExit = (exit: Exit.Exit<any, E>) => {
33-
if (exit._tag === "Failure") {
33+
if (exit._tag === "Failure" && !Cause.isInterruptedOnly(exit.cause)) {
3434
Deferred.unsafeDone(closeLatch, Exit.die(Cause.squash(exit.cause)))
3535
}
3636
}

packages/platform-node/src/internal/workerRunner.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const platformRunnerImpl = Runner.PlatformRunner.of({
3030
const fiberSet = yield* FiberSet.make<any, WorkerError | E>()
3131
const runFork = Runtime.runFork(runtime)
3232
const onExit = (exit: Exit.Exit<any, E>) => {
33-
if (exit._tag === "Failure") {
33+
if (exit._tag === "Failure" && !Cause.isInterruptedOnly(exit.cause)) {
3434
Deferred.unsafeDone(closeLatch, Exit.die(Cause.squash(exit.cause)))
3535
}
3636
}

0 commit comments

Comments
 (0)