@epikodelabs/streamix / src/public-api / commit
Function: commit()
commit<
T>(factory,maxRetries?,delay?):Atom<T>
Defined in: projects/libraries/streamix/src/lib/factories/commit.ts:27
Creates an atomic retrying atom that commits values only after a full attempt completes successfully.
Unlike retry, this operator buffers values produced during each attempt. If an attempt fails, the buffered values are discarded and the next retry starts from a clean state. When an attempt completes, its buffered values are emitted downstream in order.
This is useful when retries should preserve all-or-nothing visibility for a sequence, while retry itself remains pass-through.
Type Parameters
T
T = any
The type of values emitted by the source stream.
Parameters
factory
() => PipeInput<T>
A factory executed for each attempt. The produced result is normalized through toAsyncIterable, so it may be an atom, stream, iterable, promise, or plain value.
maxRetries?
MaybePromise<number> = 3
The maximum number of retry operations allowed. A value of 0 runs a single attempt.
delay?
MaybePromise<number> = 1000
The delay window in milliseconds to pause between attempts.
Returns
Atom<T>
An atom that emits values only after an attempt finishes successfully.