getAddress.Sequence.SequenceGenerator.ExecAsync C# (CSharp) Method

ExecAsync() private method

private ExecAsync ( SequenceKey sequenceKey, int retryAttempt ) : Task
sequenceKey SequenceKey
retryAttempt int
return Task
        private async Task<long> ExecAsync(SequenceKey sequenceKey, int retryAttempt)
        {
            var result = await TryGetSequenceValue(sequenceKey);

            if (!result.Result)
            {
                if (retryAttempt < MaxNumberOfAttempts)
                {
                    retryAttempt++;

                    result.Value = await ExecAsync(sequenceKey, retryAttempt);
                }
                else
                {
                    throw new MaxRetryAttemptReachedException(MaxNumberOfAttempts);
                }
            }

            return result.Value;
        }