Skip to content

withStreamRetry

function withStreamRetry<T>(factory, opts?): AsyncGenerator<T>;

Defined in: core/src/retry.ts:168

The streaming twin of withRetry. A retry happens only while NOTHING has been yielded yet.

factory is re-invoked per attempt and gets a fresh signal, so an abandoned attempt’s upstream request is cancelled rather than left racing the retry. Once the first chunk is out, the stream is committed and any later failure propagates untouched.

Type Parameter
T
Parameter Type
factory (signal, attempt) => AsyncIterable<T>
opts RetryOptions

AsyncGenerator<T>