t3-code-android-nightly/.repos/effect-smol/packages/effect/test/persistence/SqlCleanupTest.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

22 lines
709 B
TypeScript

import { Duration, Effect, Schedule } from "effect"
import { sqlCleanupBatchSize } from "effect/internal/persistence"
import { TestClock } from "effect/testing"
export const expiredEntryCount = sqlCleanupBatchSize + 1
export const expiredAtEpoch = 0
export const futureExpiresAt = Number.MAX_SAFE_INTEGER
export const cleanupBatchDelay = Duration.millis(10)
export const testTimeout = 30_000
export const waitForCount = <E, R>(
effect: Effect.Effect<number, E, R>,
predicate: (count: number) => boolean
) =>
effect.pipe(
Effect.repeat({
until: predicate,
schedule: Schedule.spaced(cleanupBatchDelay)
}),
Effect.timeout(Duration.millis(testTimeout)),
TestClock.withLive
)