diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-08-29 19:11:53 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-08-29 19:11:53 -0500 |
| commit | 5b063c478b5d5f8e694a5cdea76af0d8eada3150 (patch) | |
| tree | 8ab0a4c0095b28c6a1a1ec9a965098292cba70a0 /src/slskd/Core/API/Controllers/LogsController.cs | |
| parent | ec02691a206451e9e9c11a2f305ab928c6f9676b (diff) | |
| download | slskd-5b063c478b5d5f8e694a5cdea76af0d8eada3150.tar.gz | |
leave note about streaming optimization
Diffstat (limited to 'src/slskd/Core/API/Controllers/LogsController.cs')
| -rw-r--r-- | src/slskd/Core/API/Controllers/LogsController.cs | 4 |
1 files changed, 4 insertions, 0 deletions
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); |
