private async Task RefreshAsync()

in src/Amazon.SecretsManager.Extensions.Caching/SecretCacheObject.cs [148:168]


        private async Task<bool> RefreshAsync(CancellationToken cancellationToken = default)
        {
            if (!IsRefreshNeeded()) { return false; }
            refreshNeeded = false;
            try
            {
                SetResult(await ExecuteRefreshAsync(cancellationToken));
                exception = null;
                exceptionCount = 0;
                return true;
            }
            catch (Exception ex) when (ex is AmazonServiceException || ex is AmazonClientException)
            {
                exception = ex;
                // Determine the amount of growth in exception backoff time based on the growth
                // factor and default backoff duration.

                nextRetryTime = Environment.TickCount + EXCEPTION_JITTERED_DELAY.GetRetryDelay((int)exceptionCount).Milliseconds;
            }
            return false;
        }