private TokenContainer NextToken() { lock (_nextTokenLock) { TokenContainer result = _tokenProviders[_index]; if (_index >= _tokenProviders.Count - 1) { _index = 0; } else { _index++; } return(result); } }
/// <summary> /// Ignore the token timeout rate limit and just grab the token. /// </summary> /// <returns></returns> public string Get() { TokenContainer container = NextToken(); return(container.Get()); }
/// <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)); }