Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/logger/src/transports/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export class StorageTransport implements ITransport {
// only prune logs if total size is greater than maxLogsSize
const totalLogSize = await this._getTotalSize();
if (totalLogSize > this.maxLogsSize) {
let sizeOverBy = totalLogSize - this.maxLogsSize;
let sizeOverBy = this.maxLogsSize;
let cutoffTime = 0;

try {
Expand All @@ -316,9 +316,8 @@ export class StorageTransport implements ITransport {
.reverse()
.each((log: Logs) => {
sizeOverBy -= log.size;
if (sizeOverBy <= 0) {
if (sizeOverBy <= 0 && cutoffTime === 0) {
cutoffTime = log.time;
Comment thread
unadlib marked this conversation as resolved.
throw new Error('cutoff found');
}
});
} catch (_) {
Expand Down