Exemple #1
0
        private TokenContainer NextToken()
        {
            lock (_nextTokenLock)
            {
                TokenContainer result = _tokenProviders[_index];

                if (_index >= _tokenProviders.Count - 1)
                {
                    _index = 0;
                }
                else
                {
                    _index++;
                }

                return(result);
            }
        }
Exemple #2
0
        /// <summary>
        /// Ignore the token timeout rate limit and just grab the token.
        /// </summary>
        /// <returns></returns>
        public string Get()
        {
            TokenContainer container = NextToken();

            return(container.Get());
        }
Exemple #3
0
        /// <summary>
        /// Returns the token after awaiting the token timeout rate limit.
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async ValueTask <string> GetAsync(CancellationToken?cancellationToken = null)
        {
            TokenContainer container = NextToken();

            return(await container.GetAsync(cancellationToken));
        }