Skip to content

Missing RetryUntil/RetryWhen #449

@JanEggers

Description

@JanEggers

i tried to implement RetryUntil in my code with:

public static Task<T> RetryUntil<T,TOther>(this object any, IObservable<T> obs, IObservable<TOther> end)
        {
            using ( var cts = new CancellationTokenSource())
            using (end.Subscribe(v => cts.Cancel(true)))
            {
                return obs
                    .Retry()
                    .TakeUntil(end)
                    .ToTask(cts.Token);
            }
        }

but that gives me an invalidOperationException: "Sequence Contains no Elements". if end publishes a value.

Is there any way i can get a TaskCancellation Exception.

Also RetryWhen is missing from Rx.net and id like to retry after some amount of time rather than instant. How can i do that without RetryWhen?

Is there any reason the above methods are not included? / may i submit a pr?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions