diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-04-26 13:16:32 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-04-26 13:16:32 -0500 |
| commit | da732237ce6e87b40ccd0b042255e19e40d27682 (patch) | |
| tree | 7312305bf9a3b037c643079fdc93bc02e31838bb /src | |
| parent | 003b291e20788bba6229bd043688d208eb6261fe (diff) | |
| download | slskd-da732237ce6e87b40ccd0b042255e19e40d27682.tar.gz | |
remove deprecated Summarize method from UploadService
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Transfers/Uploads/UploadService.cs | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs index 72e3c0ef..e0d11a11 100644 --- a/src/slskd/Transfers/Uploads/UploadService.cs +++ b/src/slskd/Transfers/Uploads/UploadService.cs @@ -101,16 +101,6 @@ namespace slskd.Transfers.Uploads Transfer Find(Expression<Func<Transfer, bool>> expression); /// <summary> - /// Returns a summary of the uploads matching the specified <paramref name="expression"/>. This can be expensive; - /// consider caching. - /// </summary> - /// <param name="expression">The expression used to select uploads for summarization.</param> - /// <returns> - /// The generated summary, including the number of files and total size in bytes. - /// </returns> - (int Files, long Bytes) Summarize(Expression<Func<Transfer, bool>> expression); - - /// <summary> /// Gets upload statistics for the specified <paramref name="username"/>. /// </summary> /// <param name="username">The username of the user.</param> @@ -741,46 +731,6 @@ namespace slskd.Transfers.Uploads } /// <summary> - /// Returns a summary of the uploads matching the specified <paramref name="expression"/>. This can be expensive; - /// consider caching. - /// </summary> - /// <param name="expression">The expression used to select uploads for summarization.</param> - /// <returns> - /// The generated summary, including the number of files and total size in bytes. - /// </returns> - public (int Files, long Bytes) Summarize(Expression<Func<Transfer, bool>> expression) - { - expression ??= t => true; - - try - { - using var context = ContextFactory.CreateDbContext(); - - var query = context.Transfers - .AsNoTracking() - .Where(t => t.Direction == TransferDirection.Upload) - .Where(expression) - .GroupBy(t => true) // https://stackoverflow.com/a/25489456: The GroupBy(x => true) statement places all items into a single group. The Select statement the allows operations against each group. - .Select(t => new - { - Files = t.Count(), - Bytes = t.Sum(x => x.Size), - }); - - Log.Verbose("{Method} SQL: {@Query}", nameof(Summarize), query.ToQueryString()); - - var stats = query.FirstOrDefault(); - - return (stats?.Files ?? 0, stats?.Bytes ?? 0); - } - catch (Exception ex) - { - Log.Error(ex, "Failed to list uploads: {Message}", ex.Message); - throw; - } - } - - /// <summary> /// Returns a list of all uploads matching the optional <paramref name="expression"/>. /// </summary> /// <param name="expression">An optional expression used to match uploads.</param> |
