Amazon.S3.Internal.AmazonS3RetryPolicy.RetryForExceptionAsync C# (CSharp) 메소드

RetryForExceptionAsync() 공개 메소드

Return true if the request should be retried. Implements additional checks specific to S3 on top of the checks in DefaultRetryPolicy.
public RetryForExceptionAsync ( Runtime executionContext, Exception exception ) : Task
executionContext Runtime Request context containing the state of the request.
exception System.Exception The exception thrown by the previous request.
리턴 Task
        public override async Task<bool> RetryForExceptionAsync(Runtime.IExecutionContext executionContext, Exception exception)
        {
            var syncResult = RetryForExceptionSync(executionContext, exception);
            if (syncResult.HasValue)
            {
                return syncResult.Value;
            }
            else
            {
                var serviceException = exception as AmazonServiceException;
                string correctedRegion = null;
                AmazonS3Uri s3BucketUri;
                if (AmazonS3Uri.TryParseAmazonS3Uri(executionContext.RequestContext.Request.Endpoint, out s3BucketUri))
                {
                    var credentials = executionContext.RequestContext.ImmutableCredentials;
                    correctedRegion = await BucketRegionDetector.DetectMismatchWithHeadBucketFallbackAsync(s3BucketUri, serviceException, credentials).ConfigureAwait(false);
                }

                if (correctedRegion == null)
                {
                    return base.RetryForException(executionContext, exception);
                }
                else
                {
                    // change authentication region of request and signal the handler to sign again with the new region
                    executionContext.RequestContext.Request.AuthenticationRegion = correctedRegion;
                    executionContext.RequestContext.IsSigned = false;
                    return true;
                }
            }
        }
    }