diff --git a/packages/effect-fc-next/src/ScopeRegistry.ts b/packages/effect-fc-next/src/ScopeRegistry.ts index 7720aaf..dc5cb67 100644 --- a/packages/effect-fc-next/src/ScopeRegistry.ts +++ b/packages/effect-fc-next/src/ScopeRegistry.ts @@ -44,10 +44,9 @@ export class ScopeRegistryServiceImpl implements ScopeRegistryService { options: ScopeRegistryService.RegisterOptions, ): Effect.Effect { return Effect.gen({ self: this }, function*() { - const now = yield* DateTime.now const entry = Equal.byReference({ scope: yield* Scope.make(options.finalizerExecutionStrategy), - expiresAt: Option.some(DateTime.addDuration(now, options.finalizerExecutionDebounce)), + expiresAt: Option.some(DateTime.addDuration(yield* DateTime.now, options.finalizerExecutionDebounce)), finalizerExecutionDebounce: options.finalizerExecutionDebounce, }) @@ -115,12 +114,12 @@ export class ScopeRegistryServiceImpl implements ScopeRegistryService { get closeExpired(): Effect.Effect { return Effect.flatMap(DateTime.now, now => SubscriptionRef.modify( this.ref, - entries => HashMap.reduce( - entries, + HashMap.reduce( [ Chunk.empty(), HashMap.empty(), ] as const, + ([expired, remaining], entry, key) => Option.exists( entry.expiresAt, expiresAt => DateTime.isLessThanOrEqualTo(expiresAt, now),