Exemplo n.º 1
0
            private async Task GetAndUpdateAccountPropertiesAsync(Uri endpoint)
            {
                try
                {
                    if (this.CancellationTokenSource.IsCancellationRequested)
                    {
                        return;
                    }

                    AccountProperties databaseAccount = await this.GetDatabaseAccountFn(endpoint);

                    if (databaseAccount != null)
                    {
                        this.AccountProperties = databaseAccount;
                        this.CancellationTokenSource.Cancel();
                    }
                }
                catch (Exception e)
                {
                    DefaultTrace.TraceInformation("GlobalEndpointManager: Fail to reach gateway endpoint {0}, {1}", endpoint, e.ToString());
                    if (GetAccountPropertiesHelper.IsNonRetriableException(e))
                    {
                        DefaultTrace.TraceInformation("GlobalEndpointManager: Exception is not retriable");
                        this.CancellationTokenSource.Cancel();
                        this.NonRetriableException = e;
                    }
                    else
                    {
                        this.LastTransientException = e;
                    }
                }
            }
Exemplo n.º 2
0
        public static Task <AccountProperties> GetDatabaseAccountFromAnyLocationsAsync(
            Uri defaultEndpoint,
            IList <string>?locations,
            Func <Uri, Task <AccountProperties> > getDatabaseAccountFn)
        {
            GetAccountPropertiesHelper threadSafeGetAccountHelper = new GetAccountPropertiesHelper(
                defaultEndpoint,
                locations?.GetEnumerator(),
                getDatabaseAccountFn);

            return(threadSafeGetAccountHelper.GetAccountPropertiesAsync());
        }