@@ -44,10 +44,9 @@ export class ScopeRegistryServiceImpl implements ScopeRegistryService {
|
|||||||
options: ScopeRegistryService.RegisterOptions,
|
options: ScopeRegistryService.RegisterOptions,
|
||||||
): Effect.Effect<ScopeRegistryService.Entry> {
|
): Effect.Effect<ScopeRegistryService.Entry> {
|
||||||
return Effect.gen({ self: this }, function*() {
|
return Effect.gen({ self: this }, function*() {
|
||||||
const now = yield* DateTime.now
|
|
||||||
const entry = Equal.byReference({
|
const entry = Equal.byReference({
|
||||||
scope: yield* Scope.make(options.finalizerExecutionStrategy),
|
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,
|
finalizerExecutionDebounce: options.finalizerExecutionDebounce,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -115,12 +114,12 @@ export class ScopeRegistryServiceImpl implements ScopeRegistryService {
|
|||||||
get closeExpired(): Effect.Effect<void> {
|
get closeExpired(): Effect.Effect<void> {
|
||||||
return Effect.flatMap(DateTime.now, now => SubscriptionRef.modify(
|
return Effect.flatMap(DateTime.now, now => SubscriptionRef.modify(
|
||||||
this.ref,
|
this.ref,
|
||||||
entries => HashMap.reduce(
|
HashMap.reduce(
|
||||||
entries,
|
|
||||||
[
|
[
|
||||||
Chunk.empty<ScopeRegistryService.Entry>(),
|
Chunk.empty<ScopeRegistryService.Entry>(),
|
||||||
HashMap.empty<ScopeRegistryService.Key, ScopeRegistryService.Entry>(),
|
HashMap.empty<ScopeRegistryService.Key, ScopeRegistryService.Entry>(),
|
||||||
] as const,
|
] as const,
|
||||||
|
|
||||||
([expired, remaining], entry, key) => Option.exists(
|
([expired, remaining], entry, key) => Option.exists(
|
||||||
entry.expiresAt,
|
entry.expiresAt,
|
||||||
expiresAt => DateTime.isLessThanOrEqualTo(expiresAt, now),
|
expiresAt => DateTime.isLessThanOrEqualTo(expiresAt, now),
|
||||||
|
|||||||
Reference in New Issue
Block a user