Hyperlinkv0.8.0-beta.28

QueueHyperlink

export interface QueueHyperlinkConfigBase<T> {
  /** Queue name used for log annotations and error messages. @default "anonymous" */
  readonly name?: string;
  /** Start with processing paused. Call `resume` to begin. @default false */
  readonly paused?: boolean;
  /**
   * When `false`, worker fibers are **not** forked until
   * {@link QueueHandleApi.start} runs. Enqueue still succeeds; items accumulate until workers exist.
   * `pause` / `resume` update the latch before or after `start` — workers observe it once forked.
   *
   * @default true (preserve historic behavior: fork workers as soon as the queue scope acquires).
   */
  readonly autoStart?: boolean;
  /** Max items processing concurrently (worker count). @default 5 */
  readonly concurrency?: number;
  /**
   * Optional Effect `RateLimiter` on item workers (before concurrency semaphore).
   * Omitted = no rate limit (only `concurrency`).
   */
  readonly rateLimit?: QueueHyperlinkRateLimitOptions;
  /** Max items per priority queue (bounded backpressure). @default 50_000 */
  readonly capacity?: number;
  /**
   * Number of priority lanes. The default queue uses 3 (`high`=0, `normal`=1, `low`=2).
   *
   * @default 3
   */
  readonly levelCount?: number;
  /**
   * How workers pick among non-empty lanes when taking the next item. `"priority"` is strict
   * lowest-index-first (the default 3-level behavior). `"weighted"` and `"strict-descending"`
   * apply to all configured levels; a {@link CustomTakeAlgorithm} function is also accepted.
   *
   * @default "priority"
   */
  readonly takeAlgorithm?: TakeAlgorithm;
  /**
   * Extract a deduplication key from each item. When set, items with a key
   * already in-flight (enqueued or processing) are silently dropped.
   * The key is released after the worker `effect` completes.
   */
  readonly key?: (item: T) => string;
  /**
   * Max **attempts** for an item — the initial try plus automatic re-enqueues. On failure the
   * worker re-enqueues the item at its **own priority**, preserving its attempt count, until
   * `attempts` is reached; then it's exhausted (emits a `RetryExhausted` event). Observe the
   * `RetryScheduled` / `RetryExhausted` lifecycle on the {@link QueueHandleApi.events} stream.
   *
   * In-place retry of the worker effect is a separate concern — put `Effect.retry(...)` on your
   * `effect`.
   *
   * @default 1 (try once; no auto re-enqueue)
   */
  readonly attempts?: number;
  /**
   * How {@link QueueHandleApi.shutdown} winds down. Either way it stops accepting new items
   * immediately (status `phase` → `"draining"`), lets in-flight items finish, and once the queue
   * is empty + idle emits `ShutdownComplete` and sets `phase` → `"off"`. They differ on the
   * **already-queued** items:
   * - `"drain"` — process the remaining queued items first (graceful; nothing is lost). **Default.**
   * - `"finishActive"` — discard the queued items (emit a `Dropped` event for them) and only let
   *   the in-flight ones finish (fast stop; with future persistence the discarded items are what a
   *   restart would rebuild).
   *
   * @default "drain"
   */
  readonly shutdownMode?: "drain" | "finishActive";
}
Referenced by 3 symbols