Skip to content

AsyncQueueSink

Defined in: packages/app-report/src/sink/async-queue-sink.ts:52

Decouples the emitter from a slow sink via a bounded, background-drained queue.

Overflow is handled by position, never by importance: a full queue drops the oldest or the newest event, blocks, or throws, according to its policy. There is deliberately no “shed the least important first” option, because a generic ReportEvent carries no severity — only SinkProbe does — and severity is a per-domain concept (a logger assigns one; a subprocess exit code has none), so there is no extractor to fall back on. A caller who needs it can filter before enqueueing, where the domain is still known.

TData

new AsyncQueueSink<TData>(sink, options?): AsyncQueueSink<TData>

Defined in: packages/app-report/src/sink/async-queue-sink.ts:72

ISink<TData>

AsyncQueueSinkOptions<TData>

AsyncQueueSink<TData>

close(signal?): Promise<void>

Defined in: packages/app-report/src/sink/async-queue-sink.ts:168

Drains the queue, then closes the wrapped sink.

AbortSignal

Promise<void>

ISink.close


enabled(probe): boolean

Defined in: packages/app-report/src/sink/async-queue-sink.ts:123

Fast path: veto before the emitter allocates the event. Default: always enabled.

SinkProbe

boolean

ISink.enabled


flush(signal?): Promise<void>

Defined in: packages/app-report/src/sink/async-queue-sink.ts:162

Waits until every event written so far has reached the wrapped sink.

Races against the drain loop itself: without onSinkError, a crashed drain loop never signals drained, and waiting on it alone would hang forever instead of surfacing the crash.

AbortSignal

Promise<void>

ISink.flush


write(event, signal?): Promise<void>

Defined in: packages/app-report/src/sink/async-queue-sink.ts:127

ReportEvent<TData>

AbortSignal

Promise<void>

ISink.write