Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Dec 16, 2023
1 parent f9309b7 commit eb5bc56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ArchiSteamFarm/Steam/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ internal async Task<bool> 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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit eb5bc56

Please sign in to comment.