in RESTProxy/Models/Endpoint.cs [411:428]
private async Task<string> GetAccessTokenAsync()
{
if (this.ValidThru.CompareTo(DateTime.Now) <= 0)
{
using (await this.AsyncLock.LockAsync())
{
// To optimize the normal case, we won't acquire a lock when initially checking ValidThru,
// but that means we have to do the same comparison again once we grab the lock
// to make sure that it's still necessary to refresh once we grab it.
if (this.ValidThru.CompareTo(DateTime.Now) <= 0)
{
await this.RefreshAccessTokenAsync();
}
}
}
return this.AccessToken;
}