File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,11 +105,15 @@ function flushPendingLogs() {
105105 continue
106106 }
107107
108+ const boundedQueuedEntries = queuedEntries . length > MAX_LOG_ENTRIES
109+ ? queuedEntries . slice ( - MAX_LOG_ENTRIES )
110+ : queuedEntries
111+
108112 const target = next ?? prev
109113 const existing = target . get ( instanceId ) ?? [ ]
110114 const updated = existing . length === 0
111- ? queuedEntries . slice ( - MAX_LOG_ENTRIES )
112- : [ ...existing , ...queuedEntries ] . slice ( - MAX_LOG_ENTRIES )
115+ ? boundedQueuedEntries
116+ : [ ...existing , ...boundedQueuedEntries ] . slice ( - MAX_LOG_ENTRIES )
113117
114118 if ( updated === existing ) {
115119 continue
@@ -642,6 +646,9 @@ function addLog(id: string, entry: LogEntry) {
642646 const queued = pendingLogEntries . get ( id )
643647 if ( queued ) {
644648 queued . push ( entry )
649+ if ( queued . length > MAX_LOG_ENTRIES ) {
650+ queued . splice ( 0 , queued . length - MAX_LOG_ENTRIES )
651+ }
645652 } else {
646653 pendingLogEntries . set ( id , [ entry ] )
647654 }
You can’t perform that action at this time.
0 commit comments