From 99fcbf712d40a90ac5c8843237d26914146d7312 Mon Sep 17 00:00:00 2001 From: Johannes Schickling Date: Mon, 3 Mar 2025 22:16:40 +0100 Subject: [PATCH] Bug fix: change interruptible order in platform shutdown flow (#4539) --- .changeset/popular-ducks-guess.md | 6 ++++++ packages/platform-bun/src/internal/worker.ts | 2 +- packages/platform-node/src/internal/worker.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/popular-ducks-guess.md diff --git a/.changeset/popular-ducks-guess.md b/.changeset/popular-ducks-guess.md new file mode 100644 index 00000000000..e8bfc09f8a5 --- /dev/null +++ b/.changeset/popular-ducks-guess.md @@ -0,0 +1,6 @@ +--- +"@effect/platform-node": patch +"@effect/platform-bun": patch +--- + +Fixed interruption of timeout in worker shutdown diff --git a/packages/platform-bun/src/internal/worker.ts b/packages/platform-bun/src/internal/worker.ts index ffe95beaa6b..37e4a30372e 100644 --- a/packages/platform-bun/src/internal/worker.ts +++ b/packages/platform-bun/src/internal/worker.ts @@ -19,8 +19,8 @@ const platformWorkerImpl = Worker.makePlatform()({ worker.postMessage([1]) return Deferred.await(closeDeferred) }).pipe( - Effect.interruptible, Effect.timeout(5000), + Effect.interruptible, Effect.catchAllCause(() => Effect.sync(() => worker.terminate())) ) ), diff --git a/packages/platform-node/src/internal/worker.ts b/packages/platform-node/src/internal/worker.ts index 5b5aaa554cd..61b7f211121 100644 --- a/packages/platform-node/src/internal/worker.ts +++ b/packages/platform-node/src/internal/worker.ts @@ -20,8 +20,8 @@ const platformWorkerImpl = Worker.makePlatform()({ worker.postMessage([1]) return Deferred.await(exitDeferred) }).pipe( - Effect.interruptible, Effect.timeout(5000), + Effect.interruptible, Effect.catchAllCause(() => Effect.sync(() => worker.terminate())) ) ),