diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-09-15 17:47:04 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-09-15 17:47:04 -0500 |
| commit | 1eb7649c460518bbedae2bc25fae120b9faf8157 (patch) | |
| tree | 6db4cc7c29f10f68dd84d9c66b161b1e16c272a6 | |
| parent | 7f77d6e9c67e5f3c8166e4696b0b5751dd9d7055 (diff) | |
| download | slskd-1eb7649c460518bbedae2bc25fae120b9faf8157.tar.gz | |
don't prune events (yet?)
| -rw-r--r-- | config/slskd.example.yml | 1 | ||||
| -rw-r--r-- | src/slskd/Application.cs | 1 | ||||
| -rw-r--r-- | src/slskd/Core/Options.cs | 6 | ||||
| -rw-r--r-- | src/slskd/Events/EventService.cs | 29 |
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 |
