private void HandleResult(ThrottlingRpcResult rpcResult, long requestStartTime, long requestCompletionTime, ThrottlingRpcClient client) { long msecInterval = ThrottlingRpcClientImpl.GetMsecInterval(requestStartTime, requestCompletionTime); if (rpcResult != ThrottlingRpcResult.Failed && msecInterval <= 5000L) { this.HandleSuccessfulResponse(); } else if (rpcResult != ThrottlingRpcResult.Failed) { ThrottlingRpcClientImpl.tracer.TraceError <string, long>(0L, "RPC request to mailbox server {0} took {1} milliseconds and treated as failed", this.serverName, msecInterval); ThrottlingRpcClientImpl.EventLogger.LogEvent(ThrottlingClientEventLogConstants.Tuple_RpcRequestTimedout, this.serverName, new object[] { this.serverName, msecInterval }); this.HandleFailure(requestCompletionTime, null); } else { this.HandleFailure(requestCompletionTime, client); } ThrottlingRpcClientImpl.Unref(client); this.perfCounters.AddRequestStatus(rpcResult, msecInterval); }
private bool ShouldBypassRpc() { if (this.failureCount >= 2) { long msecInterval = ThrottlingRpcClientImpl.GetMsecInterval(this.lastFailureTime, Stopwatch.GetTimestamp()); if (msecInterval < 60000L) { ThrottlingRpcClientImpl.EventLogger.LogEvent(ThrottlingClientEventLogConstants.Tuple_RpcRequestBypassed, this.serverName, new object[] { this.serverName, this.failureCount, TimeSpan.FromMilliseconds((double)msecInterval) }); return(true); } } return(false); }