aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-09-15 17:47:04 -0500
committerJP Dillingham <jp@dillingham.me>2024-09-15 17:47:04 -0500
commit1eb7649c460518bbedae2bc25fae120b9faf8157 (patch)
tree6db4cc7c29f10f68dd84d9c66b161b1e16c272a6
parent7f77d6e9c67e5f3c8166e4696b0b5751dd9d7055 (diff)
downloadslskd-1eb7649c460518bbedae2bc25fae120b9faf8157.tar.gz
don't prune events (yet?)
-rw-r--r--config/slskd.example.yml1
-rw-r--r--src/slskd/Application.cs1
-rw-r--r--src/slskd/Core/Options.cs6
-rw-r--r--src/slskd/Events/EventService.cs29
4 files changed, 0 insertions, 37 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml
index d4f99b21..4b4f0996 100644
--- a/config/slskd.example.yml
+++ b/config/slskd.example.yml
@@ -168,7 +168,6 @@
# files:
# complete: 20160 # 2 weeks
# incomplete: 43200 # 30 days
-# events: 30 # days
# logs: 180 # days
# logger:
# disk: false
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 1d13f73c..d441160e 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -1013,7 +1013,6 @@ namespace slskd
private void Clock_EveryHour(object sender, ClockEventArgs e)
{
- _ = Task.Run(() => Events.Prune(ageInDays: Options.Retention.Events));
_ = Task.Run(() => MaybeRescanShares());
}
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 97b596d0..0f86ff62 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -1323,12 +1323,6 @@ namespace slskd
public FileRetentionOptions Files { get; init; } = new FileRetentionOptions();
/// <summary>
- /// Gets the time to retain events, in days.
- /// </summary>
- [Range(1, maximum: int.MaxValue)]
- public int Events { get; init; } = 30;
-
- /// <summary>
/// Gets the time to retain logs, in days.
/// </summary>
[Range(1, maximum: int.MaxValue)]
diff --git a/src/slskd/Events/EventService.cs b/src/slskd/Events/EventService.cs
index 188d5895..85f82238 100644
--- a/src/slskd/Events/EventService.cs
+++ b/src/slskd/Events/EventService.cs
@@ -66,33 +66,4 @@ public class EventService
throw;
}
}
-
- /// <summary>
- /// Removes event records older than the specified <paramref name="ageInDays"/>.
- /// </summary>
- /// <param name="ageInDays">The age after which event records are eligible for pruning, in days.</param>
- /// <returns>The number of pruned event records.</returns>
- public virtual int Prune(int ageInDays)
- {
- try
- {
- using var context = ContextFactory.CreateDbContext();
-
- var cutoffDateTime = DateTime.UtcNow.AddDays(-ageInDays);
-
- var pruned = context.Events.Where(e => e.Timestamp < cutoffDateTime).ExecuteDelete();
-
- if (pruned > 0)
- {
- Log.Debug("Pruned {Count} expired events", pruned);
- }
-
- return pruned;
- }
- catch (Exception ex)
- {
- Log.Error(ex, "Failed to prune events: {Message}", ex.Message);
- throw;
- }
- }
} \ No newline at end of file