aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Activity
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-10-14 11:44:11 -0600
committercrobibero <cody@robibe.ro>2020-10-14 11:44:11 -0600
commit15a7f88e083a78a4219cbd004e6041b49c490b05 (patch)
treea75f427df91b8d30b2edb488ec81c8789731c869 /Jellyfin.Server.Implementations/Activity
parentd54de29485cc622a64c17884b39c9bc65e33af29 (diff)
Automatically clean activity log database
Diffstat (limited to 'Jellyfin.Server.Implementations/Activity')
-rw-r--r--Jellyfin.Server.Implementations/Activity/ActivityManager.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs
index 5926abfe0..7bde4f35b 100644
--- a/Jellyfin.Server.Implementations/Activity/ActivityManager.cs
+++ b/Jellyfin.Server.Implementations/Activity/ActivityManager.cs
@@ -72,6 +72,18 @@ namespace Jellyfin.Server.Implementations.Activity
};
}
+ /// <inheritdoc />
+ public async Task CleanAsync(DateTime startDate)
+ {
+ await using var dbContext = _provider.CreateContext();
+ var entries = dbContext.ActivityLogs
+ .AsQueryable()
+ .Where(entry => entry.DateCreated <= startDate);
+
+ dbContext.RemoveRange(entries);
+ await dbContext.SaveChangesAsync().ConfigureAwait(false);
+ }
+
private static ActivityLogEntry ConvertToOldModel(ActivityLog entry)
{
return new ActivityLogEntry