t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/GCP/Dataplex/quota.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

16 lines
717 B
TypeScript

import type * as Effect from "effect/Effect";
import * as Semaphore from "effect/Semaphore";
/**
* Dataplex throttles control-plane writes per project per minute. With the
* whole suite running in one process, more than a few concurrent Dataplex
* lifecycles exhaust the quota and time out, so every Dataplex test holds
* one of these slots for its whole body. A test's timeout includes the time
* it waits for a slot, so Dataplex tests use generous (15 min) timeouts.
*/
const slots = Semaphore.makeUnsafe(4);
/** Run a Dataplex test body while holding one API-quota slot. */
export const withDataplexSlot = <A, E, R>(
self: Effect.Effect<A, E, R>,
): Effect.Effect<A, E, R> => slots.withPermits(1)(self);