fix(destination-buffer): return entries in chronological order (oldest-first) and adjust pagination semantics

This commit is contained in:
2026-02-20 08:57:22 +00:00
parent dbcfeba16d
commit 9a61a3a9af
4 changed files with 24 additions and 13 deletions

View File

@@ -50,11 +50,11 @@ export class SmartlogDestinationBuffer implements ILogDestination {
results = results.filter((pkg) => pkg.timestamp >= options.since);
}
// Return newest-first, with pagination
return results
.slice()
.reverse()
.slice(offset, offset + limit);
// Return most recent `limit` entries in chronological order (oldest-first)
// offset skips from the newest end
const start = Math.max(0, results.length - limit - offset);
const end = results.length - offset;
return results.slice(Math.max(0, start), Math.max(0, end));
}
public getEntryCount(): number {