fix(destination-buffer): return entries in chronological order (oldest-first) and adjust pagination semantics
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user