From eb5bc560a49b88869898b6dd8aa28a0de7c71c22 Mon Sep 17 00:00:00 2001 From: Archi Date: Sat, 16 Dec 2023 14:33:32 +0100 Subject: [PATCH] Misc --- ArchiSteamFarm/Steam/Bot.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 7021841857b38..d582eece44b2c 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -1562,7 +1562,7 @@ internal async Task RefreshWebSession(bool force = false) { DateTime now = DateTime.UtcNow; - if (!force && !string.IsNullOrEmpty(AccessToken) && AccessTokenValidUntil.HasValue && (AccessTokenValidUntil.Value > now.AddMinutes(MinimumAccessTokenValidityMinutes))) { + if (!force && !string.IsNullOrEmpty(AccessToken) && AccessTokenValidUntil.HasValue && (AccessTokenValidUntil.Value >= now.AddMinutes(MinimumAccessTokenValidityMinutes))) { // We can use the tokens we already have if (await ArchiWebHandler.Init(SteamID, SteamClient.Universe, AccessToken, SteamParentalActive ? BotConfig.SteamParentalCode : null).ConfigureAwait(false)) { InitRefreshTokensTimer(AccessTokenValidUntil.Value); @@ -3295,7 +3295,7 @@ private async void OnPlayingSessionState(SteamUser.PlayingSessionStateCallback c private async void OnRefreshTokensTimer(object? state = null) { DateTime accessTokenValidUntil = AccessTokenValidUntil.GetValueOrDefault(); - if ((accessTokenValidUntil > DateTime.MinValue) && (accessTokenValidUntil > DateTime.UtcNow.AddMinutes(MinimumAccessTokenValidityMinutes))) { + if ((accessTokenValidUntil > DateTime.MinValue) && (accessTokenValidUntil > DateTime.UtcNow.AddMinutes(MinimumAccessTokenValidityMinutes + 1))) { // We don't need to refresh just yet InitRefreshTokensTimer(accessTokenValidUntil);