Fix one of the causes of watchdog crashes in WidgetDataEncoder by fetching just the count of starred articles — instead of fetching all the starred articles and counting them, which can take a long time.

This commit is contained in:
Brent Simmons
2022-05-12 21:56:49 -07:00
parent fdadb80863
commit a0e8ca00ee
5 changed files with 81 additions and 16 deletions

View File

@@ -73,7 +73,7 @@ public final class WidgetDataEncoder {
let latestData = WidgetData(currentUnreadCount: SmartFeedsController.shared.unreadFeed.unreadCount,
currentTodayCount: SmartFeedsController.shared.todayFeed.unreadCount,
currentStarredCount: try! SmartFeedsController.shared.starredFeed.fetchArticles().count,
currentStarredCount: try AccountManager.shared.fetchCountForStarredArticles(),
unreadArticles: unread,
starredArticles: starred,
todayArticles:today,