aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Transfers
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-12-17 16:31:12 -0600
committerGitHub <noreply@github.com>2024-12-17 16:31:12 -0600
commitac4518147eebd921edb7cf465013eabc37fae4e7 (patch)
tree5de10a59601042e0c9bd9e4a168e2e26a9165342 /src/slskd/Transfers
parentf1b250ccd31bfbb38d47ebd3570c072539c98430 (diff)
parent57704f7a402bd779c74b42b460c6bb0d206cbe0c (diff)
downloadslskd-ac4518147eebd921edb7cf465013eabc37fae4e7.tar.gz
Merge pull request #1257 from slskd/search-retention
Add the ability to configure search record retention
Diffstat (limited to 'src/slskd/Transfers')
-rw-r--r--src/slskd/Transfers/Uploads/UploadService.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs
index aeb2f63c..fa9a3359 100644
--- a/src/slskd/Transfers/Uploads/UploadService.cs
+++ b/src/slskd/Transfers/Uploads/UploadService.cs
@@ -94,7 +94,7 @@ namespace slskd.Transfers.Uploads
/// <summary>
/// Removes <see cref="TransferStates.Completed"/> uploads older than the specified <paramref name="age"/>.
/// </summary>
- /// <param name="age">The age after which uploads are eligible for pruning, in hours.</param>
+ /// <param name="age">The age after which uploads are eligible for pruning, in minutes.</param>
/// <param name="state">An optional, additional state by which uploads are filtered for pruning.</param>
/// <returns>The number of pruned uploads.</returns>
int Prune(int age, TransferStates state = TransferStates.Completed);
@@ -533,7 +533,7 @@ namespace slskd.Transfers.Uploads
/// <summary>
/// Removes <see cref="TransferStates.Completed"/> uploads older than the specified <paramref name="age"/>.
/// </summary>
- /// <param name="age">The age after which uploads are eligible for pruning, in hours.</param>
+ /// <param name="age">The age after which uploads are eligible for pruning, in minutes.</param>
/// <param name="state">An optional, additional state by which uploads are filtered for pruning.</param>
/// <returns>The number of pruned uploads.</returns>
public int Prune(int age, TransferStates state = TransferStates.Completed)
@@ -553,7 +553,11 @@ namespace slskd.Transfers.Uploads
.Where(t => t.Direction == TransferDirection.Upload)
.Where(t => !t.Removed)
.Where(t => t.EndedAt.HasValue && t.EndedAt.Value < cutoffDateTime)
- .Where(t => t.State == state) // https://github.com/dotnet/efcore/issues/20094
+
+ // note: don't try HasFlag() here: https://github.com/dotnet/efcore/issues/20094
+ // this won't work because the state is stored as a comma separated string (which we've done deliberately)
+ // and EF won't do the necessary work to generate the required SQL
+ .Where(t => t.State == state)
.ToList();
foreach (var tx in expired)