Fix
Lint / lint (push) Failing after 48s

This commit is contained in:
Julien Valverdé
2026-07-23 03:13:17 +02:00
parent c6eeb7b8bc
commit 7e816d041e
+11 -14
View File
@@ -1,4 +1,4 @@
import { type Cause, Context, DateTime, type Duration, Effect, Equal, Exit, flow, HashMap, Layer, Option, Order, Scope, Semaphore, Stream, SubscriptionRef } from "effect" import { type Cause, Chunk, Context, DateTime, type Duration, Effect, Equal, Exit, HashMap, Layer, Option, Order, Scope, Semaphore, Stream, SubscriptionRef } from "effect"
export interface ScopeRegistryService { export interface ScopeRegistryService {
@@ -115,22 +115,19 @@ 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 => { entries => HashMap.reduce(
const expired: ScopeRegistryService.Entry[] = [] entries,
const remaining = HashMap.filter(entries, entry => { [
const shouldClose = Option.exists( Chunk.empty<ScopeRegistryService.Entry>(),
HashMap.empty<ScopeRegistryService.Key, ScopeRegistryService.Entry>(),
] as const,
([expired, remaining], entry, key) => Option.exists(
entry.expiresAt, entry.expiresAt,
expiresAt => DateTime.isLessThanOrEqualTo(expiresAt, now), expiresAt => DateTime.isLessThanOrEqualTo(expiresAt, now),
) )
? [Chunk.append(expired, entry), remaining] as const
if (shouldClose) : [expired, HashMap.set(remaining, key, entry)] as const,
expired.push(entry) ),
return !shouldClose
})
return [expired, remaining]
},
)).pipe( )).pipe(
Effect.flatMap(entries => Effect.forEach( Effect.flatMap(entries => Effect.forEach(
entries, entries,