added log trim command

This commit is contained in:
Keivan Beigi
2013-06-18 18:01:08 -07:00
parent 279f8b5d73
commit 73f3459264
16 changed files with 62 additions and 69 deletions

View File

@@ -1,6 +1,4 @@
using System;
using System.Data;
using System.Linq;
using NzbDrone.Common.Messaging;
using NzbDrone.Core.Datastore;
@@ -20,8 +18,8 @@ namespace NzbDrone.Core.Instrumentation
public void Trim()
{
var oldIds = Query.Where(c => c.Time < DateTime.UtcNow.AddDays(-30).Date).Select(c => c.Id);
DeleteMany(oldIds);
var trimDate = DateTime.UtcNow.AddDays(-15).Date;
Delete(c => c.Time <= trimDate);
}
}
}