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

Timeline cache #663

Closed
wants to merge 23 commits into from
Closed

Timeline cache #663

wants to merge 23 commits into from

Conversation

charlag
Copy link
Collaborator

@charlag charlag commented May 26, 2018

(this is branched from the #562 )
This is PR aims to add kind of a an offline cache to the timelines. Something like Mastalab and Pinafore have.
It is a super tricky topic (cache invalidation, you know) but the potential benefit is huge.
I was surprised that I was able to make this initial implementation in a pretty efficient way (no N+1 requests, two JOINs).
The hardest part is reblogs. The easy way would be to seialize reblogged toot but I think I've came up with something much more efficient, see TimelineStatusEntity.

We should thoughtfully discuss caching strategy. There's a wonderfully illustrated explanation on the topic. I'd say we use "cache than network". It would updating timeline two times but that's the hardest part, actual request race is trivial with Rx.

Another thing is that we should stop relying on headers for timeline paging because it's incompatible with offline caching.

Anyway, it's not ready but I would like to hear your feedback on this.

@charlag
Copy link
Collaborator Author

charlag commented May 27, 2018

Okay, let's track things

  • Tables for statuses and accounts
  • Query for all of it
  • Conversion between DB entities and objects
  • Remembering timeline position and restoring it (may need more love)
  • Correct infinite loading and gap handling (still glitchy/works not in all cases)
  • Multiple accounts (it should work but it's not really tested yet)
  • Handling deleted statuses (maybe in the future)

@mal0ki
Copy link
Member

mal0ki commented Aug 26, 2018

There is a new PR on this, rebased by charlag
#809

@mal0ki mal0ki closed this Aug 26, 2018
@connyduck connyduck deleted the offline branch December 3, 2018 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants