Пример #1
0
 /// <summary>
 /// 异步结果返回,回调继续
 /// </summary>
 /// <param name="result"></param>
 protected virtual void AsyncBackResult(Result result)
 {
     if (AsyncResultDict.TryRemove(result.Id, out AsyncResultAwaiter <Result> asyncback))
     {
         asyncback.Completed(result);
     }
     else
     {
         if (result.IsError)
         {
             try
             {
                 Log.Error($"ErrorType:{(ErrorType)result.ErrorId} ErrMsg:\r\n{result.ErrorMsg}  ");
             }
             catch
             {
                 Log.Error($"ErrorType:{result.ErrorId} ErrMsg:\r\n{result.ErrorMsg}  ");
             }
         }
         else
         {
             Log.ErrorFormat("not find back ruest id:{0}", result.Id);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// 异步结果返回,回调继续
 /// </summary>
 /// <param name="result"></param>
 protected virtual void AsyncBackResult(Result result)
 {
     if (AsyncResultDict.TryRemove(result.Id, out ManualResetValueTaskSource <Result> asyncback))
     {
         asyncback.SetResult(result);
     }
     else
     {
         if (result.IsError)
         {
             try
             {
                 Log.Error($"ErrorType:{(ErrorType)result.ErrorId} ErrMsg:\r\n{result.ErrorMsg}  ");
             }
             catch
             {
                 Log.Error($"ErrorType:{result.ErrorId} ErrMsg:\r\n{result.ErrorMsg}  ");
             }
         }
         else
         {
             Log.ErrorFormat("not find back ruest id:{0}", result.Id);
         }
     }
 }
Пример #3
0
 /// <summary>
 /// 异步结果返回,回调继续
 /// </summary>
 /// <param name="result"></param>
 protected virtual void AsyncBackResult(Result result)
 {
     if (AsyncResultDict.TryRemove(result.Id, out ManualResetValueTaskSource <Result> asyncback))
     {
         if (asyncback.GetStatus(asyncback.Version) == ValueTaskSourceStatus.Pending)
         {
             asyncback.SetResult(result);
         }
     }
     else
     {
         if (result.IsError)
         {
             try
             {
                 Log.ErrorFormat("ErrorType:{ErrorId} ErrMsg:\r\n{ErrorMsg}"
                                 , (ErrorType)result.ErrorId
                                 , result?.ErrorMsg ?? "null");
             }
             catch
             {
                 Log.ErrorFormat("ErrorType:{ErrorId} ErrMsg:\r\n{ErrorMsg}"
                                 , result.ErrorId
                                 , result?.ErrorMsg ?? "null");
             }
         }
         else
         {
             Log.ErrorFormat("not find back ruest id:{0}", result.Id);
         }
     }
 }