File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Packages/Timeline/Sources/Timeline/actors Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ public actor TimelineCache {
102102// MARK: - Encoding helpers
103103
104104private extension TimelineCache {
105- var maxCachedStatuses : Int { 600 }
105+ var maxCachedStatuses : Int { 800 }
106106
107107 private func prepareItemsForCaching( _ items: [ TimelineItem ] ) -> [ CachedTimelineItem ] {
108108 limitedItems ( items, limit: maxCachedStatuses) . map { item in
@@ -138,20 +138,21 @@ private extension TimelineCache {
138138 }
139139
140140 private func limitedItems( _ items: [ TimelineItem ] , limit: Int ) -> [ TimelineItem ] {
141+ guard limit > 0 else { return [ ] }
142+
141143 var collected : [ TimelineItem ] = [ ]
142144 var statusCount = 0
143145
144146 for item in items {
145- if statusCount >= limit { break }
146-
147147 switch item {
148148 case . status:
149+ guard statusCount < limit else { continue }
149150 collected. append ( item)
150151 statusCount += 1
151152 case . gap:
152- if statusCount > 0 {
153- collected. append ( item)
154- }
153+ guard statusCount > 0 else { continue }
154+ collected. append ( item)
155+ if statusCount >= limit { return collected }
155156 }
156157 }
157158
You can’t perform that action at this time.
0 commit comments