From e6181c24124d97f2fbc932b8a68311e625463156 Mon Sep 17 00:00:00 2001 From: uzvkl Date: Tue, 11 Jun 2019 23:05:52 +0200 Subject: Move dsa related stuff to subfolder --- FireBase/Extensions/ObservableExtensions.cs | 41 ----------------------------- FireBase/Extensions/TaskExtensions.cs | 23 ---------------- 2 files changed, 64 deletions(-) delete mode 100644 FireBase/Extensions/ObservableExtensions.cs delete mode 100644 FireBase/Extensions/TaskExtensions.cs (limited to 'FireBase/Extensions') diff --git a/FireBase/Extensions/ObservableExtensions.cs b/FireBase/Extensions/ObservableExtensions.cs deleted file mode 100644 index 0a672d7..0000000 --- a/FireBase/Extensions/ObservableExtensions.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Reactive.Linq; - -namespace Firebase.Database.Extensions -{ - public static class ObservableExtensions - { - /// - /// Returns a cold observable which retries (re-subscribes to) the source observable on error until it successfully - /// terminates. - /// - /// The source observable. - /// How long to wait between attempts. - /// A predicate determining for which exceptions to retry. Defaults to all - /// - /// A cold observable which retries (re-subscribes to) the source observable on error up to the - /// specified number of times or until it successfully terminates. - /// - public static IObservable RetryAfterDelay( - this IObservable source, - TimeSpan dueTime, - Func retryOnError) - where TException : Exception - { - var attempt = 0; - - return Observable.Defer(() => - { - return (++attempt == 1 ? source : source.DelaySubscription(dueTime)) - .Select(item => new Tuple(true, item, null)) - .Catch, TException>(e => retryOnError(e) - ? Observable.Throw>(e) - : Observable.Return(new Tuple(false, default(T), e))); - }) - .Retry() - .SelectMany(t => t.Item1 - ? Observable.Return(t.Item2) - : Observable.Throw(t.Item3)); - } - } -} \ No newline at end of file diff --git a/FireBase/Extensions/TaskExtensions.cs b/FireBase/Extensions/TaskExtensions.cs deleted file mode 100644 index c955b3a..0000000 --- a/FireBase/Extensions/TaskExtensions.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Threading.Tasks; - -namespace Firebase.Database.Extensions -{ - public static class TaskExtensions - { - /// - /// Instead of unwrapping it throws it as it is. - /// - public static async Task WithAggregateException(this Task source) - { - try - { - await source.ConfigureAwait(false); - } - catch (Exception ex) - { - throw source.Exception ?? ex; - } - } - } -} \ No newline at end of file -- cgit v1.2.3-54-g00ecf