-
-
Notifications
You must be signed in to change notification settings - Fork 387
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
Caching toots - attempt 2 #809
Conversation
I've updated PR to fix some errors. At least some caching is working now but I am still not sure how to mark gaps in DB |
The offline part works, very well done. |
Thanks for checking it out!
|
what if when a placeholder is encountered, we only save the upper part of the timeline? |
And delete everything below? That would be unpleasant |
Yes, but it should be a cache and not a save-the-whole-timeline-forever thing, shouldn't it? Another possible solution could be to use one of the ids that presumably belong inside the gap to the placeholder? The id of the toot above the gap minus 1 or something? |
Uuugh, maybe my problem is that I was trying to do exactly this? With future search and everything. You proposal could lead to clashes easily, especially on small instances and I would rather not. |
It definitely needs some clean up logic to prevent database size to grow forever |
Yup, but that's another problem and it's pretty easy to solve imo |
not sure why it could happen because |
I've tried adding a migration but didn't really check it yet. |
Some progress on this I've also fixed some problems with duplicated DB entries. Mixing statuses between accounts should be fixed now but I didn't check. Need to save some more account fields to work correctly. There's a hack for the initial request which asks for statuses with margin of 11 which seems to be working but maybe not always and we should figure this out. We can improve thread loading by not reloading the toot itself now when we have it in the DB. |
Also not forget to create an index on timeline account entities as Room proposes, otherwise updates will be slow Also don't forget to update statuses on events |
Rebased on master, fixed couple of small things, will check how it'll work. |
OK, first pull-to-refresh doesn't work, uuugh |
Works better now, maybe we can really get there. |
Hey, I know I've said that you can review it but I already see some conceptual problems. |
As I said, I think we still need to implement gaps indicator. Top: we check that the oldest of returned statuses to us is a known to us. If not, but a gap into DB with Middle: we do the same check for both top and bottom. If we did not overlap with known statuses on one edge, we insert gap on that edge with ID in the middle. Bottom: we always insert gap below known things. We fill the gap if no statuses are returned (server cannot give them to us). So far I don't see a problem with this approach. Id of the gap should always be an id between real statuses we know about. When we load statuses in the gap, we either replace the gap with a status with the same ID or we don't and the gap is still there. We should think if we should should prevent double gaps and how to do that (we don't want to see two gaps together in a timeline e.g.) I'm sorry that I dismissed that idea before, now I think that it may even work. |
I tested a build from commit 7f0836e. Here is what I noticed:
|
Thx for testing! I think most of it should be solved by the next commit now but we will need to re-test anyway |
Uff, much stuff today.
|
One of the biggest remainig problems is "too many placeholders" (thing are not so bad if it's a problem I think). We should discuss if we want to include saving position in this PR or implement it later. It shouldn't be a big problem but this is already huge. |
I've spent quite some time trying to find out why timeline Mastodon API is acting so weirdly. @connyduck can I have your opinion on including position remembering in this PR or not? |
Installing new build right now, will give you feedback tomorrow! Lets leave remembering position for now and focus on getting this merged, we can add it later. I think it should not be too much effort then. |
Thanks! I won't be near PC for the weekend but next week I can apply feedback! |
It seems that migrations work now! |
😱 |
I've tried to rebase #663 but it was branched from another branch and it is too old so I failed.
Instead I've
cherry-pick
ed last 5 commits from that branch which seem to contain useful changes.I did not try it yet because I'm out of energy already but it can be useful for someone to inspect or fix.