Resolved an error in the new logging cleanup (#389)

This commit is contained in:
Michael Green
2024-07-10 11:53:37 +10:00
committed by GitHub
parent 590a7829b1
commit 6d7f6f63c6

View File

@@ -38,10 +38,10 @@ namespace gaseous_server.Classes
long deletedCount = 1;
long deletedEventCount = 0;
long maxLoops = 1000;
sql = "DELETE FROM ServerLogs WHERE EventTime < @EventRetentionDate LIMIT 1000; SELECT ROW_COUNT() AS Count;";
dbDict.Add("EventRetentionDate", DateTime.UtcNow.AddDays(Config.LoggingConfiguration.LogRetention * -1));
while (deletedCount > 0)
{
sql = "DELETE FROM ServerLogs WHERE EventTime < @EventRetentionDate LIMIT 1000; SELECT ROW_COUNT() AS Count;";
dbDict.Add("EventRetentionDate", DateTime.UtcNow.AddDays(Config.LoggingConfiguration.LogRetention * -1));
DataTable deletedCountTable = db.ExecuteCMD(sql, dbDict);
deletedCount = (long)deletedCountTable.Rows[0][0];
deletedEventCount += deletedCount;