From da732237ce6e87b40ccd0b042255e19e40d27682 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 26 Apr 2026 13:16:32 -0500 Subject: remove deprecated Summarize method from UploadService --- src/slskd/Transfers/Uploads/UploadService.cs | 50 ---------------------------- 1 file changed, 50 deletions(-) (limited to 'src') 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 @@ -100,16 +100,6 @@ namespace slskd.Transfers.Uploads /// The found transfer, or default if not found. Transfer Find(Expression> expression); - /// - /// Returns a summary of the uploads matching the specified . This can be expensive; - /// consider caching. - /// - /// The expression used to select uploads for summarization. - /// - /// The generated summary, including the number of files and total size in bytes. - /// - (int Files, long Bytes) Summarize(Expression> expression); - /// /// Gets upload statistics for the specified . /// @@ -740,46 +730,6 @@ namespace slskd.Transfers.Uploads } } - /// - /// Returns a summary of the uploads matching the specified . This can be expensive; - /// consider caching. - /// - /// The expression used to select uploads for summarization. - /// - /// The generated summary, including the number of files and total size in bytes. - /// - public (int Files, long Bytes) Summarize(Expression> 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; - } - } - /// /// Returns a list of all uploads matching the optional . /// -- cgit v1.2.3