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