Fix IPIntel causing frequent errors with the cleanup job. (#34428)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
Myra
2025-01-14 21:38:26 +01:00
committed by GitHub
parent 8e7f440243
commit 13edd308bf
3 changed files with 18 additions and 6 deletions

View File

@@ -1774,8 +1774,11 @@ INSERT INTO player_round (players_id, rounds_id) VALUES ({players[player]}, {id}
{
await using var db = await GetDb();
// Calculating this here cause otherwise sqlite whines.
var cutoffTime = DateTime.UtcNow.Subtract(range);
await db.DbContext.IPIntelCache
.Where(w => DateTime.UtcNow - w.Time >= range)
.Where(w => w.Time <= cutoffTime)
.ExecuteDeleteAsync();
await db.DbContext.SaveChangesAsync();