コード例 #1
0
        // This is executed in a new thread each time, so it is safe to use blocking calls
        protected override void Ready()
        {
            TimeoutRetryResult resultTimeout = Client.Testing.TimeoutRetry(Request.DEFAULT_RESPONSE_TIMEOUT_SECONDS * 3);

            if (!resultTimeout.Successful)
            {
                Logger.LogError("Timeout was unsuccessful");
                Completed.Set();
                return;
            }

            Successful = true;
            Completed.Set();
        }
コード例 #2
0
        private async Task <TimeoutRetryResult> InternalTimeoutRetryAsync(LL_TimeoutRetryParams @params, int ttl = Request.DEFAULT_RESPONSE_TIMEOUT_SECONDS)
        {
            TimeoutRetryResult resultTimeout = new TimeoutRetryResult();

            try
            {
                Task <LL_TimeoutRetryResult> taskLLTimeout = LL_TimeoutRetryAsync(@params, ttl);

                // The use of await rethrows exceptions from the task
                LL_TimeoutRetryResult resultLLTimeout = await taskLLTimeout;
                ThrowIfError(resultLLTimeout.Code, resultLLTimeout.Message);
                if (resultLLTimeout.Code == "200")
                {
                    resultTimeout.Successful = true;
                }
            }
            catch (Exception exc)
            {
                Log(LogLevel.Error, exc, "Timeout exception");
            }

            return(resultTimeout);
        }