From 82901c4c149e7d928feb994dd95ed8513153f6d4 Mon Sep 17 00:00:00 2001 From: Farrel Darian <62016900+fdarian@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:26:12 +0700 Subject: [PATCH 1/2] fix: remove extract function to prevent memory leak in Inngest handler The extract function was keeping references alive, causing memory leak. Now directly using Effect.scoped() to properly manage resource cleanup. --- packages/effect/src/for/inngest/index.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/effect/src/for/inngest/index.ts b/packages/effect/src/for/inngest/index.ts index 5d6a28b..e7bee04 100644 --- a/packages/effect/src/for/inngest/index.ts +++ b/packages/effect/src/for/inngest/index.ts @@ -9,7 +9,6 @@ import type { InngestFunction, } from 'inngest'; import { serve } from 'inngest/bun'; -import { extract } from '../../extract'; import { cronToString } from './cron'; import { wrapStep } from './step'; @@ -114,7 +113,6 @@ export function createInngest< ) => Effect.gen(function* () { const c = yield* Tag; - const ext_handler = yield* extract(handler); const resolvedTrigger = resolveTrigger(trigger); const runPromise = yield* FiberSet.makeRuntimePromise(); @@ -125,13 +123,15 @@ export function createInngest< async (ctx: any) => { const effectStep = wrapStep(ctx.step); return runPromise( - ext_handler({ - ...ctx, - step: effectStep, - } as unknown as EffectHandlerCtx< - TClient, - ExtractTriggerName - >), + Effect.scoped( + handler({ + ...ctx, + step: effectStep, + } as unknown as EffectHandlerCtx< + TClient, + ExtractTriggerName + >), + ) as unknown as Effect.Effect, ); }, ) as unknown as InngestFunction.Any; From 6661edfa2e47e687dce2ac77645ccf63b813a222 Mon Sep 17 00:00:00 2001 From: Farrel Darian <62016900+fdarian@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:34:16 +0700 Subject: [PATCH 2/2] docs: changeset --- .changeset/llhi-sqkr-oest.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/llhi-sqkr-oest.md diff --git a/.changeset/llhi-sqkr-oest.md b/.changeset/llhi-sqkr-oest.md new file mode 100644 index 0000000..bb4b33e --- /dev/null +++ b/.changeset/llhi-sqkr-oest.md @@ -0,0 +1,5 @@ +--- +"ff-effect": patch +--- + +Fix memory leak in Inngest handler: scope step FiberSets per invocation instead of leaking finalizers into the long-lived app scope