retry - richardszalay/raix GitHub Wiki
ο»ΏRetries a source sequence, by resubscribing to it when it errors
function retry(retryCount : uint = 0) : IObservable.<T>Where retryCount is the number of times to retry (after the first error), or 0 to retry indefinitely.
If the source sequence errors, it will be resubscribed to.
The returned sequence completes when the source sequence completes.
The returned sequence errors if the source sequence has been re-subscribed to retryCount number of times and errors. If retryCount is 0, the returned sequence never completes
xs ββoβββββoβββββoββββx
β β β βββoβββββoβββββoββββx
β β β β β β β
ys ββoβββββoβββββoβββββββoβββββoβββββoββββx
xs ββoβββββoβββββ/
β β β
β β β
ys ββoβββββoβββββ/IObservable.<T>
toObservable(1)
.concat([Observable.error(new Error("boo"))])
.retry(1)
.subscribe(
function(x : int) : void { trace(x); },
function():void { trace("Completed"); },
function(e:Error):void { trace("Retries failed - " + e.message); }
);
// Trace output is:
// 1
// 1
// Retries failed - boo