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

Update subscription view to be able to load videos from video cache per channel #3668

Conversation

PikachuEXE
Copy link
Collaborator

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

A variant (?) of #3665

Description

#3665 restores the "original" behaviour (well the code that was there but disabled somehow)
This is a different video caching strategy
Videos (and potentially other info like live streams and shorts) are cached per channel instead of profile
The difference is that every profile can potentially just load from cache if all the channels of selected profile have required content in cache, without the limitation of only caching one profile at a time

Screenshots

Similar to 3665 one so no repeating here

Testing

Preparation:

  • Create following profiles (other than default)
    • Profile A with most but not all channels
    • Profile B with only some channels from A
    • Profile C with some channels from A (1 is enough), some from the channel(s) excluded in A
    • Profile D with no channel

Before starting each test please reopen window/app/refresh to ensure local state is reset

A. Auto fetching disabled
A1. Loading from cache after all channel cached

  • Switch to default profile (if not already)
  • Ensure no video loaded
  • Load videos from remote (via button, KB shortcut whatever)
  • Ensure videos loaded
  • Switch to profile A
  • Ensure correct videos loaded, no network request made for fetching videos
  • Switch to profile B
  • Ensure correct videos loaded, no network request made for fetching videos
  • Switch to profile C
  • Ensure correct (no) videos loaded, no network request made for fetching videos
  • Switch to default profile
  • Ensure correct (all) videos loaded, no network request made for fetching videos

A2a. Refresh subscriptions effects - With default profile loaded first

  • Switch to default profile (if not already)
  • Load videos from remote
  • Ensure videos loaded
  • Switch to profile A
  • Load videos from remote
  • Switch to default profile
  • Ensure all videos loaded, no network request made for fetching videos
    (due to only cache for channels in profile A refreshed, but cache for not refreshed channel are not purged)
  • Switch to profile A
  • Ensure correct videos loaded, no network request made for fetching videos
  • Switch to profile B
  • Ensure correct videos loaded, no network request made for fetching videos

A2b. Refresh subscriptions effects - Without default profile loaded first

  • Switch to default profile (if not already)
  • DO NOT load videos from remote
  • Switch to profile A
  • Load videos from remote
  • Switch to default profile
  • Ensure NO videos loaded
    (due to not all channels are cached)
  • Switch to profile A
  • Ensure correct videos loaded, no network request made for fetching videos
  • Switch to profile B
  • Ensure correct videos loaded, no network request made for fetching videos
    (due to Profile B with only some channels from A)

A3. After subscribing new channel(s)

  • Switch to default profile (if not already)
  • Load videos from remote
  • Ensure videos loaded
  • Visit a random not subscribed channel, subscribe it
  • Go back to subscriptions view
  • Ensure NO videos loaded (due to not all subscribed channel cached)

B. Auto fetching enabled
B1. Loading from subscriptionsCacheForAllSubscriptionsProfile

  • Same as A1 except Load videos from remote is done automatically

B2a. Refresh subscriptions effects - With default profile loaded first

  • Switch to default profile (if not already)
  • Ensure videos loaded
  • Switch to profile A
  • Load videos from remote
  • Switch to default profile
  • Ensure all videos loaded, no network request made for fetching videos
    (due to only cache for channels in profile A refreshed, but cache for not refreshed channel are not purged)
  • Switch to profile A
  • Ensure correct videos loaded, no network request made for fetching videos
  • Switch to profile B
  • Ensure correct videos loaded, no network request made for fetching videos

B2b. Refresh subscriptions effects - Without default profile loaded first

  • Switch to non subscription view
  • Switch to profile A
  • Ensure videos loaded
  • Switch to default profile
  • Ensure videos loaded, with no. of requests matching no. of channels
    (i.e. all videos are fetched from remote not from cache)
  • Switch to profile A
  • Ensure correct videos loaded, no network request made for fetching videos
  • Switch to profile B
  • Ensure correct videos loaded, no network request made for fetching videos
    (due to Profile B with only some channels from A)

B3. After subscribing new channel(s)

  • Switch to default profile (if not already)
  • Ensure videos loaded
  • Visit a random not subscribed channel, subscribe it
  • Go back to subscriptions view
  • Ensure videos loaded, with no. of requests matching no. of channels
    (i.e. all videos are fetched from remote not from cache)

Desktop

  • OS:
  • OS Version:
  • FreeTube version:

Additional context

Fetch Feed Automatically is enabled by default
To avoid expectation issue when enabled all videos are fetch from remote (if cache for any channel absent)

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jun 15, 2023
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 15, 2023 07:02
@ChunkyProgrammer
Copy link
Member

There's a GitHub warning for src/renderer/views/Subscriptions/Subscriptions.js at line 11

@efb4f5ff-1298-471a-8973-3d47447115dc
Copy link
Member

efb4f5ff-1298-471a-8973-3d47447115dc commented Jun 27, 2023

Just to be sure, this is how B1 should be tested right?

  1. Switch to default profile (if not already)
  2. Ensure videos loaded
  3. Switch to profile A
  4. Ensure correct videos loaded, no network request made for fetching videos
  5. Switch to profile B
  6. Ensure correct videos loaded, no network request made for fetching videos
  7. Switch to profile C
  8. Ensure correct (no) videos loaded, no network request made for fetching videos
  9. Switch to default profile
  10. Ensure correct (all) videos loaded, no network request made for fetching videos

Edit: Passed all testcases, just waiting on confirmation

Copy link
Member

@ChunkyProgrammer ChunkyProgrammer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused import in src/renderer/views/Subscriptions/Subscriptions.js

@PikachuEXE
Copy link
Collaborator Author

@efb4f5ff-1298-471a-8973-3d47447115dc
Yes

@ChunkyProgrammer
Done

Now the changes includes those from #3673 (to solve code conflict in advance)
Please merge this after #3673 (that one only needs 1 more approval to be merged)

@PikachuEXE PikachuEXE force-pushed the pika/feature/subscription-view/load-videos-from-cache-per-channel branch from e5454e3 to 3310780 Compare June 28, 2023 01:19
@PikachuEXE PikachuEXE force-pushed the pika/feature/subscription-view/load-videos-from-cache-per-channel branch from 3310780 to ca8a8a7 Compare June 28, 2023 01:20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@absidue
Copy link
Member

absidue commented Jul 1, 2023

Tested this pull request and most situations work fine, however I found this one situation where it doesn't load from the cache:

Fetch feed automatically: OFF

Total channels: 50

Switch to profile 1: load the subscriptions (10 requests)
Switch to profile 2: load subscriptions (5 requests)

Don't do anything with profiles 3-8

Switch to all channels profile: load subscriptions (requests 50, expected 35 as I expected it to load the 15 previously loaded ones from the cache)

@absidue
Copy link
Member

absidue commented Jul 1, 2023

Is that behaviour expected or is that a bug?

@PikachuEXE
Copy link
Collaborator Author

@absidue
I consider manual reload as "fetch all subscription from remote"
It is what it means right now and I find it rare to change that
To alter that behaviour we need new settings which should not be part of this PR

Copy link
Member

@absidue absidue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as your explanation makes sense.

@FreeTubeBot FreeTubeBot merged commit 242c93e into FreeTubeApp:development Jul 2, 2023
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 2, 2023
@PikachuEXE
Copy link
Collaborator Author

Now #3673 requires even more changes arrrr

@PikachuEXE PikachuEXE deleted the pika/feature/subscription-view/load-videos-from-cache-per-channel branch July 2, 2023 14:51
kommunarr added a commit to kommunarr/FreeTube that referenced this pull request Apr 14, 2024
kommunarr added a commit to kommunarr/FreeTube that referenced this pull request Apr 14, 2024
FreeTubeBot pushed a commit that referenced this pull request Apr 17, 2024
…4380)

* Implement first draft of last subscription refresh timestamp

* Update styling to be a top bar

* Update styling to be banner-compatible, & increase banner X button size on mobile

* Update subscription refresh timestamp to be relative

* Implement refresh timestamps for Shorts, Live, and Community tabs

* Extract refresh widget to its own component

* Add Trending and Popular refresh widgets with timestamps

* Fix justifying when no timestamp exists

* Move timestamps to utils store

* Remove unneeded ref classes and currentLocale computed property

* Add page-specific titles for each feed type

* Implement showing least recent cache date per profile

* Update styling property placement & match top nav box shadow on ft-refresh-widget

* Implement showing timestamp for profile only if all channel subscriptions can be found in cache

* Disable refresh button instead of removing it or the widget from the DOM

* Increase top banner's top margin

* Update channel caching calls to provide timestamps

* Modify updateCacheByChannel functions to have default timestamp of new Date()

* Fix 30-day month relative date calculation scenarios through new optional parameter

* Rectify Case 3 (see #3668)

* Add back missing line in Popular.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants