diff --git a/packages/effect-fc-next/src/ScopeRegistry.ts b/packages/effect-fc-next/src/ScopeRegistry.ts index dc5cb67..0bdee76 100644 --- a/packages/effect-fc-next/src/ScopeRegistry.ts +++ b/packages/effect-fc-next/src/ScopeRegistry.ts @@ -12,7 +12,6 @@ export interface ScopeRegistryService { release(key: ScopeRegistryService.Key): Effect.Effect readonly run: Effect.Effect - readonly dispose: Effect.Effect } export declare namespace ScopeRegistryService { @@ -94,6 +93,7 @@ export class ScopeRegistryServiceImpl implements ScopeRegistryService { )), })), Stream.runDrain, + Effect.ensuring(this.dispose), this.runSemaphore.withPermit, ) } @@ -173,8 +173,5 @@ export class ScopeRegistry extends Context.Service Effect.andThen( - Effect.addFinalizer(() => registry.dispose), - Effect.forkScoped(registry.run), - ), + registry => Effect.forkScoped(registry.run), ))