public ResponseData DoBatchWithIDDic(RequestType type, string id, Dictionary <string, string> dic) { lock (_syncLocker) { id.KeyCheck(); RedisCoder.RequestForDicWidthID(type, id, dic); var result = RedisCoder.Decoder(type); if (result.Type == ResponseType.Redirect) { return((ResponseData)OnRedirect.Invoke(result.Data, OperationType.DoBatchWithIDDic, type, id, dic)); } else { return(result); } } }
public ResponseData <string> DoBatchWithIDDic(RequestType type, string id, Dictionary <string, string> dic) { id.KeyCheck(); ResponseData <string> result = new ResponseData <string>() { Type = ResponseType.Empty, Data = "未知的命令" }; try { lock (SyncRoot) { using (var cts = new CancellationTokenSource(_actionTimeout)) { RedisCoder.RequestForDicWidthID(type, id, dic); result = RedisCoder.Decoder <string>(type, cts.Token); if (result != null && result.Type == ResponseType.Redirect) { return((ResponseData <string>)OnRedirect.Invoke(result.Data, OperationType.DoBatchWithIDDic, type, id, dic)); } else { return(result); } } } } catch (TaskCanceledException tex) { result.Type = ResponseType.Error; result.Data = "Action Timeout"; } catch (Exception ex) { result.Type = ResponseType.Error; result.Data = ex.Message; } return(result); }
public ResponseData DoBatchWithIDDic(RequestType type, string id, Dictionary <string, string> dic) { id.KeyCheck(); ResponseData result = new ResponseData() { Type = ResponseType.Empty, Data = "未知的命令" }; try { result = TaskHelper.Run((token) => { lock (SyncRoot) { RedisCoder.RequestForDicWidthID(type, id, dic); var result = RedisCoder.Decoder(type, token); if (result != null && result.Type == ResponseType.Redirect) { return((ResponseData)OnRedirect.Invoke(result.Data, OperationType.DoBatchWithIDDic, type, id, dic)); } else { return(result); } } }, _actionTimeout).Result; } catch (TaskCanceledException tex) { result.Type = ResponseType.Error; result.Data = "Action Timeout"; } catch (Exception ex) { result.Type = ResponseType.Error; result.Data = ex.Message; } return(result); }