Skip to content

Commit

Permalink
It just expires like that what
Browse files Browse the repository at this point in the history
  • Loading branch information
Simyon264 committed Jun 30, 2024
1 parent 793d48b commit 989665f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ReplayBrowser/Controllers/ReplayController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task<IActionResult> GetPlayerData(Guid profileGuid)

try
{
return Ok(await _replayHelper.GetPlayerProfile(profileGuid, authState));
return Ok(await _replayHelper.GetPlayerProfile(profileGuid, authState, TimeSpan.FromHours(2)));
}
catch (UnauthorizedAccessException e)
{
Expand Down
4 changes: 2 additions & 2 deletions ReplayBrowser/Helpers/ReplayHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task<List<Replay>> GetMostRecentReplays(AuthenticationState state)
/// Fetches a player profile from the database.
/// </summary>
/// <exception cref="UnauthorizedAccessException">Thrown when the account is private and the requestor is not the account owner or an admin.</exception>
public async Task<CollectedPlayerData?> GetPlayerProfile(Guid playerGuid, AuthenticationState authenticationState, bool skipCache = false, bool skipPermsCheck = false)
public async Task<CollectedPlayerData?> GetPlayerProfile(Guid playerGuid, AuthenticationState authenticationState, TimeSpan cacheExpire, bool skipCache = false, bool skipPermsCheck = false)
{
var accountCaller = await _accountService.GetAccount(authenticationState);

Expand Down Expand Up @@ -232,7 +232,7 @@ public async Task<List<Replay>> GetMostRecentReplays(AuthenticationState state)
});
}

_cache.Set(cacheKey, collectedPlayerData, TimeSpan.FromMinutes(120));
_cache.Set(cacheKey, collectedPlayerData, cacheExpire);

return collectedPlayerData;
}
Expand Down
2 changes: 1 addition & 1 deletion ReplayBrowser/Pages/Profile.razor
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ else
IsLoggedIn = true;
}

_playerData = await ReplayHelper.GetPlayerProfile(guidParsed, authState);
_playerData = await ReplayHelper.GetPlayerProfile(guidParsed, authState, TimeSpan.FromHours(2));
_playerData.Characters = _playerData.Characters.OrderByDescending(x => x.RoundsPlayed).ToList();
_playerData.JobCount = _playerData.JobCount.OrderByDescending(x => x.RoundsPlayed).ToList();
}
Expand Down
2 changes: 1 addition & 1 deletion ReplayBrowser/Services/ProfilePregeneratorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private async void PregenerateProfiles()

foreach (var guid in profilesToGenerate)
{
await replayHelper.GetPlayerProfile(guid, new AuthenticationState(new ClaimsPrincipal()), true, true);
await replayHelper.GetPlayerProfile(guid, new AuthenticationState(new ClaimsPrincipal()), TimeSpan.FromDays(999), true, true);
Log.Information("Pregenerated profile for {Guid}.", guid);
_generatedProfiles.Add(guid);
PregenerationProgress.Current++;
Expand Down

0 comments on commit 989665f

Please sign in to comment.