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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user