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.
Type Parameters
Section titled “Type Parameters”TData
Implements
Section titled “Implements”ISink<TData>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AsyncQueueSink<
TData>(sink,options?):AsyncQueueSink<TData>
Defined in: packages/app-report/src/sink/async-queue-sink.ts:72
Parameters
Section titled “Parameters”ISink<TData>
options?
Section titled “options?”AsyncQueueSinkOptions<TData>
Returns
Section titled “Returns”AsyncQueueSink<TData>
Methods
Section titled “Methods”close()
Section titled “close()”close(
signal?):Promise<void>
Defined in: packages/app-report/src/sink/async-queue-sink.ts:168
Drains the queue, then closes the wrapped sink.
Parameters
Section titled “Parameters”signal?
Section titled “signal?”AbortSignal
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”enabled()
Section titled “enabled()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”flush()
Section titled “flush()”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.
Parameters
Section titled “Parameters”signal?
Section titled “signal?”AbortSignal
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”write()
Section titled “write()”write(
event,signal?):Promise<void>
Defined in: packages/app-report/src/sink/async-queue-sink.ts:127
Parameters
Section titled “Parameters”ReportEvent<TData>
signal?
Section titled “signal?”AbortSignal
Returns
Section titled “Returns”Promise<void>