Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix timeline reloading and favs/boosts/polls showing up at wrong pos #1374

Merged
merged 1 commit into from Jul 10, 2019

Conversation

Projects
None yet
4 participants
@connyduck
Copy link
Member

commented Jul 8, 2019

No description provided.

@connyduck connyduck requested a review from charlag Jul 8, 2019

@@ -74,12 +74,12 @@ AND
abstract fun removeAllPlaceholdersBetween(account: Long, maxId: String, sinceId: String)

@Query("""UPDATE TimelineStatusEntity SET favourited = :favourited
WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId - :statusId)""")
WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId = :statusId)""")

This comment has been minimized.

Copy link
@connyduck

connyduck Jul 8, 2019

Author Member

what was the minus doing here 😶

This comment has been minimized.

Copy link
@charlag

charlag Jul 8, 2019

Collaborator

🤦‍♂
How on Earth did it work. How did it pass tests. Ughouhg.

@connyduck connyduck force-pushed the fix_timeline_issues branch from cebb56a to b55e93c Jul 8, 2019

if (!this.statuses.isEmpty() && topId != null) {
// clear old cached statuses
Iterator<Either<Placeholder, Status>> iterator = statuses.iterator();
Iterator<Either<Placeholder, Status>> iterator = this.statuses.iterator();

This comment has been minimized.

Copy link
@connyduck

connyduck Jul 8, 2019

Author Member

yeah... this code never actually worked because it ran on the wrong list 🙄

This comment has been minimized.

Copy link
@Nutomic

Nutomic Jul 8, 2019

That looks like very confusing variable naming. Using mStatuses or something like that for class members would really help avoid this ;)

This comment has been minimized.

Copy link
@charlag

charlag Jul 8, 2019

Collaborator

No Hungarian notation will be in the code I write 😜

This comment has been minimized.

Copy link
@Nutomic

Nutomic Jul 8, 2019

Then at least don't use the same name as a class variable and a local variable :p

This comment has been minimized.

Copy link
@charlag

charlag Jul 8, 2019

Collaborator

I would rather rename local statuses into something newStatuses or loadedStatuses

@connyduck

This comment has been minimized.

Copy link
Member Author

commented Jul 8, 2019

So here is what I think happened: The bug in the sql statements was there all the time, but nobody noticed, because the timeline reloading was working mostly correct. When I fixed the racecondition for timeline reloading in #1343, I actually broke timeline reloading, revealing the database bug. So this PR now fixes timeline reloading and the database.
Will do some extensive testing before I merge this. This is critical enough to warrant a v8.1 release, I will do it asap.

@connyduck

This comment has been minimized.

Copy link
Member Author

commented Jul 8, 2019

Ok found a problem: When reloading the status, we request older than x. In the response we do not get back x, so we don't know if it may have been deleted meanwhile and only replace old statuses beginning from x-1. Maybe we should request older than x+1, but that would probably be buggy in case somebody has two subsequent statuses in the timeline.
Its not a big problem so I am inclined to leave it for now.

@charlag

charlag approved these changes Jul 8, 2019

Copy link
Collaborator

left a comment

I cannot possibly weight all the implications of these changes, there are just too many places. Hopefulyl you ran all the little tests we have.

I don't understand what you mean "when reloading the status", sorry. API is quite annoying to deal with in that you never know for sure if there's something or not unless you do many requests to find out. Maybe it's time to move to new API parameters in some cases.

@@ -74,12 +74,12 @@ AND
abstract fun removeAllPlaceholdersBetween(account: Long, maxId: String, sinceId: String)

@Query("""UPDATE TimelineStatusEntity SET favourited = :favourited
WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId - :statusId)""")
WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId = :statusId)""")

This comment has been minimized.

Copy link
@charlag

charlag Jul 8, 2019

Collaborator

🤦‍♂
How on Earth did it work. How did it pass tests. Ughouhg.

if (!this.statuses.isEmpty() && topId != null) {
// clear old cached statuses
Iterator<Either<Placeholder, Status>> iterator = statuses.iterator();
Iterator<Either<Placeholder, Status>> iterator = this.statuses.iterator();

This comment has been minimized.

Copy link
@charlag

charlag Jul 8, 2019

Collaborator

I would rather rename local statuses into something newStatuses or loadedStatuses

@Tak

This comment has been minimized.

Copy link
Contributor

commented Jul 8, 2019

The changes make sense to me - although like @charlag , I don't have a good overview of all the pieces involved

@connyduck

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2019

Ok found a problem: When reloading the status, we request older than x. In the response we do not get back x, so we don't know if it may have been deleted meanwhile and only replace old statuses beginning from x-1. Maybe we should request older than x+1, but that would probably be buggy in case somebody has two subsequent statuses in the timeline.
Its not a big problem so I am inclined to leave it for now.

ok apart from that everything looks good

@connyduck connyduck merged commit db369ae into master Jul 10, 2019

1 check passed

ci/bitrise/a3e773c3c57a894c/pr Passed - Tusky
Details

@connyduck connyduck deleted the fix_timeline_issues branch Jul 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.