TelemetryPublisherFirestore.cs Increase authorization renewal from 5min to 15min before expiry time.
This commit is contained in:
parent
b6f42a7358
commit
535e348ec6
1 changed files with 3 additions and 2 deletions
|
@ -87,6 +87,7 @@ namespace NucuCar.Telemetry.Publishers
|
||||||
|
|
||||||
if (response?.StatusCode == HttpStatusCode.OK)
|
if (response?.StatusCode == HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
|
Logger?.LogInformation("Firestore authentication OK!");
|
||||||
var jsonContent = await response.GetJson();
|
var jsonContent = await response.GetJson();
|
||||||
_idToken = jsonContent.GetProperty("idToken").ToString();
|
_idToken = jsonContent.GetProperty("idToken").ToString();
|
||||||
// Setup next expire.
|
// Setup next expire.
|
||||||
|
@ -109,8 +110,8 @@ namespace NucuCar.Telemetry.Publishers
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the token is about to expire in the next 5 minutes.
|
// Check if the token is about to expire in the next 15 minutes.
|
||||||
if (DateTime.UtcNow.AddMinutes(5) < _authorizationExpiryTime)
|
if (DateTime.UtcNow.AddMinutes(15) < _authorizationExpiryTime)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue