-
Notifications
You must be signed in to change notification settings - Fork 8
retry
richardszalay edited this page May 20, 2011
·
7 revisions
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