planetary-social / planetary-ios

Social for humans, not algorithms.
https://planetary.social/
Mozilla Public License 2.0
194 stars 20 forks source link

Your post/event doesn’t show up on your timeline after publishing #1075

Open danlatorre opened 1 year ago

danlatorre commented 1 year ago

Seems to be a long-standing, very intermittent bug -- you post something it's actually posted to SSB but it takes a long time to show up on your timeline.

This could a text-post, or a like on someone else's post, and it doesn't show up on your timeline right away, it can take hours (or longer?)

e.g. I noticed this myself for the first time today, around 1:30 PM and now it's 6 PM and still I don't see these new events on my timeline.

mplorentz commented 1 year ago

I think this happened to me once and I determined that it was caused by go-ssb. Maybe this won't happen after we switch to scuttlego. Either way this flow needs some attention (see #1033).

martindsq commented 1 year ago

After gobot correctly publish something, we execute the following code:

Log.info("Published message with key \(key)")

// Copy the newly published post into the ViewDatabase immediately.
do {
    guard let self = self else {
        completionQueue.async { completion(MessageIdentifier.null, BotError.notLoggedIn) }
        return
    }
    let lastPostIndex = try self.database.largestSeqFromPublishedLog()
    let publishedPosts = try self.bot.getPublishedLog(after: lastPostIndex)
    try self.database.fillMessages(msgs: publishedPosts)
    try self.updateNumberOfPublishedMessages(for: identity)
    self.numberOfPublishedMessagesLock.unlock()
    completionQueue.async { completion(key, nil) }
} catch {
    self?.numberOfPublishedMessagesLock.unlock()
    completionQueue.async { completion(MessageIdentifier.null, error) }
}

If any try fails, we fail the whole operation, but some steps could have executed correctly. We could benefit from having a single transaction to include all operations and rollback it if one of them fails.