forked from shadowfacts/Tusker
More logging
This commit is contained in:
parent
5e73439e7b
commit
baa9dfe0f1
|
@ -355,10 +355,26 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
|
||||
@MainActor
|
||||
private func loadStatusesToRestore(position: TimelinePosition) async -> Bool {
|
||||
{
|
||||
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
||||
crumb.message = "Original statusIDs before filtering"
|
||||
crumb.data = [
|
||||
"statusIDs": position.statusIDs,
|
||||
]
|
||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
||||
}()
|
||||
let unloaded = position.statusIDs.filter({ mastodonController.persistentContainer.status(for: $0) == nil })
|
||||
guard !unloaded.isEmpty else {
|
||||
return true
|
||||
}
|
||||
{
|
||||
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
||||
crumb.message = "Unloaded ids"
|
||||
crumb.data = [
|
||||
"unloaded": unloaded
|
||||
]
|
||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
||||
}()
|
||||
let results = await withTaskGroup(of: (String, Result<Status, Swift.Error>).self) { group -> [(String, Result<Status, Swift.Error>)] in
|
||||
for id in unloaded {
|
||||
group.addTask {
|
||||
|
@ -379,6 +395,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
switch result {
|
||||
case .success(let status):
|
||||
statuses.append(status)
|
||||
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
||||
crumb.message = "Loaded status \(id)"
|
||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
||||
case .failure(let error):
|
||||
let crumb = Breadcrumb(level: .error, category: "TimelineViewController")
|
||||
crumb.message = "Error loading status"
|
||||
|
@ -391,12 +410,14 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
}
|
||||
await mastodonController.persistentContainer.addAll(statuses: statuses, in: mastodonController.persistentContainer.viewContext)
|
||||
|
||||
_ = {
|
||||
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
||||
crumb.message = "Original position statusIDs"
|
||||
crumb.message = "Position statusIDs before filtering"
|
||||
crumb.data = [
|
||||
"statusIDs": position.statusIDs,
|
||||
]
|
||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
||||
}()
|
||||
|
||||
// update the timeline position in case some statuses couldn't be loaded
|
||||
if let center = position.centerStatusID {
|
||||
|
@ -410,12 +431,14 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
!unloaded.contains(id) || statuses.contains(where: { $0.id == id })
|
||||
}
|
||||
|
||||
let crumb2 = Breadcrumb(level: .info, category: "TimelineViewController")
|
||||
crumb2.message = "Filtered position statusIDs"
|
||||
crumb2.data = [
|
||||
{
|
||||
let crumb = Breadcrumb(level: .info, category: "TimelineViewController")
|
||||
crumb.message = "Filtered position statusIDs"
|
||||
crumb.data = [
|
||||
"statusIDs": position.statusIDs,
|
||||
]
|
||||
SentrySDK.addBreadcrumb(crumb: crumb2)
|
||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
||||
}()
|
||||
|
||||
return !position.statusIDs.isEmpty
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue