var instanceClient = new AsyncExpiringLazy<ForceClient>(async data =>
{
if (data.Result == null
|| DateTime.UtcNow > data.ValidUntil.Subtract(TimeSpan.FromSeconds(5)))
{
var authClient = new AuthenticationClient();
await authClient.TokenRefreshAsync(RefreshToken, ClientId);
var client = new ForceClient(authClient.AccessInfo.InstanceUrl, authClient.ApiVersion, authClient.AccessInfo.AccessToken);
return new AsyncExpirationValue<ForceClient>
{
Result = client,
ValidUntil = DateTimeOffset.UtcNow.AddSeconds(10)
};
}
return data;
});
var client = instanceClient.Value().Result;
Part of this update is to introduce a new way of creating ForceClient with Resilience space.
ResilientStreamingClient is prefered now over StreamingClient
Part of this update is to introduce a new way of creating
ForceClient
withResilience
space.ResilientStreamingClient
is prefered now overStreamingClient