FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

Implement persistent subscription cache

Open PikachuEXE opened this issue 1 year ago • 8 comments

Pull Request Type

  • [ ] Bugfix
  • [x] Feature Implementation
  • [ ] Documentation
  • [ ] Other

Related issue

Closes #4803 Closes #4152

Description

Make subscription cache sync across multiple windows and persistent over app restarts

Screenshots

N/A

Testing

Many cases, generally (with local & IV API):

  • Disable Fetch Feed Automatically
  • Switch/mess around with profiles if wanted
  • Load videos, live, shorts, community posts
  • Open new window(s) to see effects
  • Reboot app
  • Switch to different profiles to see effects

Desktop

  • OS:
  • OS Version:
  • FreeTube version:

Additional context

  • ~~No idea how to handle updateSubscriptionShortsCacheWithChannelPageShorts~~ ~~Implemented but no idea how to test~~ Probably follow https://github.com/FreeTubeApp/FreeTube/pull/4667
  • ~~No idea why community posts in other window have like count like this~~ image

PikachuEXE avatar May 28 '24 03:05 PikachuEXE

Isnt https://github.com/FreeTubeApp/FreeTube/issues/4803 related?

Maybe this PR closes it? Idk didnt test yet😬

Yup added to OP

PikachuEXE avatar May 28 '24 10:05 PikachuEXE

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Jun 01 '24 14:06 github-actions[bot]

Conflicts have been resolved. A maintainer will review the pull request shortly.

github-actions[bot] avatar Jun 03 '24 03:06 github-actions[bot]

Updated code & DB file name to subscription cache per dev chat comment

PikachuEXE avatar Jun 05 '24 06:06 PikachuEXE

From the looks of it this also solves https://github.com/FreeTubeApp/FreeTube/issues/4152

This PR is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jul 19 '24 01:07 github-actions[bot]

I will revisit this after the shaka PR.

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Sep 02 '24 19:09 github-actions[bot]

Conflicts have been resolved. A maintainer will review the pull request shortly.

github-actions[bot] avatar Sep 03 '24 00:09 github-actions[bot]

@efb4f5ff-1298-471a-8973-3d47447115dc after the shaka PR :)

PikachuEXE avatar Sep 03 '24 00:09 PikachuEXE

For the videos, live and shorts tabs we calculate the published timestamp at the time that we fetch the data, however for the community posts we currently save the relative text timstamp 10 minutes ago. While this is a pre-existing problem, it will be much more noticable with this pull request because now we will be saving that data between app launches, instead of just in-memory for the same session.

absidue avatar Sep 08 '24 11:09 absidue

Made change to Save community post publish time in absolute time not relative time text Tested w/ local&IV API (test yourself

PikachuEXE avatar Sep 09 '24 01:09 PikachuEXE

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Sep 12 '24 00:09 github-actions[bot]

Conflicts have been resolved. A maintainer will review the pull request shortly.

github-actions[bot] avatar Sep 12 '24 00:09 github-actions[bot]

@efb4f5ff-1298-471a-8973-3d47447115dc you approved the doc PR https://github.com/FreeTubeApp/FreeTube-Docs/pull/143 but not this PR? image

PikachuEXE avatar Sep 16 '24 01:09 PikachuEXE

Why cant it persist the cache when subscribing to a new channel?

That's A3 in https://github.com/FreeTubeApp/FreeTube/pull/3668

Timestamp doesnt appear after refresh

Will fix

PikachuEXE avatar Sep 16 '24 08:09 PikachuEXE

Why cant it persist the cache when subscribing to a new channel?

That's A3 in https://github.com/FreeTubeApp/FreeTube/pull/3668

Sorry i have to pushback on this because I think that this is a dedradation of the UX if it goes in like this

At that time i had no issues with it but with this feature it doenst feel like the correct path to take

Fixed Timestamp doesnt appear after refresh

Why cant it persist the cache when subscribing to a new channel?

I think you are looking for something like https://github.com/kommunarr/FreeTube/pull/2 It's quite big and I don't think this PR should include that additional amount of code change = more time for review & test This PR improves for those with no new channel subscribed after refresh, just no improvement after new channel subscribed (worst case just refresh like now)

PikachuEXE avatar Sep 16 '24 21:09 PikachuEXE

After seeing the report in https://github.com/FreeTubeApp/FreeTube/issues/5724 I think we need to change something. I think allot of users will see this as broken behavior just like the one that reported it. I suggest to bypass the cache when on application startup.

https://github.com/FreeTubeApp/FreeTube/issues/5724 looks like a bug we didn't catch in this PR (forgot to add test case with Fetch Feed Automatically enabled, marginal case test)

Fixing today

PikachuEXE avatar Sep 24 '24 00:09 PikachuEXE