From 5b063c478b5d5f8e694a5cdea76af0d8eada3150 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 29 Aug 2026 19:11:53 -0500 Subject: leave note about streaming optimization --- src/slskd/Core/API/Controllers/LogsController.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/slskd/Core/API/Controllers') diff --git a/src/slskd/Core/API/Controllers/LogsController.cs b/src/slskd/Core/API/Controllers/LogsController.cs index fff5e843..13f8ab95 100644 --- a/src/slskd/Core/API/Controllers/LogsController.cs +++ b/src/slskd/Core/API/Controllers/LogsController.cs @@ -129,6 +129,10 @@ namespace slskd.Core.API return File(stream, "text/plain", filename); } + // future optimization: use IAsyncEnumerable to 'stream' the log records instead of beating up + // memory to build a list. save each log in memory and then emit it when the next log + // (starting with '[') is read, which indicates that it's not multi-line. in other words, a 1-log buffer + // that is flushed when the next log is read, or the file is complete var logs = await ParseLogEntriesAsync(stream); return Ok(logs); -- cgit v1.2.3