第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

可觀察的重試機(jī)制

可觀察的重試機(jī)制

C#
一只萌萌小番薯 2021-05-13 18:19:13
我正在嘗試使用C#觀察值編寫重試機(jī)制。重試具有重試次數(shù)和重試間隔重試應(yīng)執(zhí)行“ OnExecute”方法。在每個異常上,它將執(zhí)行“ OnCatch”方法。這是我嘗試做的事情:public static IObservable<T> Retry(GenericRetryExecutorRequest<T> request){    var source = Observable.Timer(TimeSpan.Zero, request.Interval)        .Select(item =>        {          return request.GenericRetryActions.OnExecute();        });    var retryObservable = source        .Retry(request.RetryCount)        .Catch(source);    return retryObservable;}public class GenericRetryExecutorRequest<T>{    public int RetryCount { get; set; } = 3;     public TimeSpan Interval { get; set; } = new TimeSpan(0,0,0,5);    public IGenericRetryActions<T> GenericRetryActions { get; set; }}public interface IGenericRetryActions<out T>{    T OnExecute();    void OnCatch();}不幸的是-它表現(xiàn)不佳:OnCatch拋出異常時,我不知道如何執(zhí)行。我嘗試了很多方法都沒有成功。OnExecute 似乎不會重復(fù)執(zhí)行(以請求間隔),以防它引發(fā)異常。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 166 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號