标签:retryWhen retry repeatWhen number pipe will delay Simplified error
src$.pipe( retryWhen(error$ => error$.pipe( switchMap(getNotifier) )) ) // can just be src$.pipe( retry({ delay: getNotifier }) ) /** * The {@link retry} operator configuration object. `retry` either accepts a `number` * or an object described by this interface. */ export interface RetryConfig { /** * The maximum number of times to retry. If `count` is omitted, `retry` will try to * resubscribe on errors infinite number of times. */ count?: number; /** * The number of milliseconds to delay before retrying, OR a function to * return a notifier for delaying. If a function is given, that function should * return a notifier that, when it emits will retry the source. If the notifier * completes _without_ emitting, the resulting observable will complete without error, * if the notifier errors, the error will be pushed to the result. */ delay?: number | ((error: any, retryCount: number) => ObservableInput<any>); /** * Whether or not to reset the retry counter when the retried subscription * emits its first value. */ resetOnSuccess?: boolean; }
// Before: a simple daly src$.pipe( retryWhen(error$ => error$.pipe( switchMap(() => timer(5000)) )) ) // Now src$.pipe( retry({ delay: 5000 }) )
标签:retryWhen,retry,repeatWhen,number,pipe,will,delay,Simplified,error 来源: https://www.cnblogs.com/Answer1215/p/16077273.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。