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

Do not overwrite cache entries when hitting RSS ratelimits #5756

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/renderer/components/subscriptions-live/subscriptions-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,13 @@ export default defineComponent({
channelCount++
const percentageComplete = (channelCount / channelsToLoadFromRemote.length) * 100
this.setProgressBarPercentage(percentageComplete)
this.updateSubscriptionLiveCacheByChannel({
channelId: channel.id,
videos: videos
})

if (videos != null) {
this.updateSubscriptionLiveCacheByChannel({
channelId: channel.id,
videos: videos
})
}

if (name || thumbnailUrl) {
subscriptionUpdates.push({
Expand All @@ -219,7 +222,7 @@ export default defineComponent({
})
}

return videos
return videos ?? []
}))).flat()

this.videoList = updateVideoListAfterProcessing(videoListFromRemote)
Expand Down Expand Up @@ -277,6 +280,12 @@ export default defineComponent({
try {
const response = await fetch(feedUrl)

if (response.status === 403) {
return {
videos: null
}
}

if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
// so we need to check the channel feed too before deciding it errored, as that only 404s if the channel was terminated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,13 @@ export default defineComponent({
channelCount++
const percentageComplete = (channelCount / channelsToLoadFromRemote.length) * 100
this.setProgressBarPercentage(percentageComplete)
this.updateSubscriptionShortsCacheByChannel({
channelId: channel.id,
videos: videos
})

if (videos != null) {
this.updateSubscriptionShortsCacheByChannel({
channelId: channel.id,
videos: videos
})
}

if (name) {
subscriptionUpdates.push({
Expand All @@ -195,7 +198,7 @@ export default defineComponent({
})
}

return videos
return videos ?? []
}))).flat()

this.videoList = updateVideoListAfterProcessing(videoListFromRemote)
Expand All @@ -213,6 +216,12 @@ export default defineComponent({
try {
const response = await fetch(feedUrl)

if (response.status === 403) {
return {
videos: null
}
}

if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
// so we need to check the channel feed too before deciding it errored, as that only 404s if the channel was terminated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,13 @@ export default defineComponent({
channelCount++
const percentageComplete = (channelCount / channelsToLoadFromRemote.length) * 100
this.setProgressBarPercentage(percentageComplete)
this.updateSubscriptionVideosCacheByChannel({
channelId: channel.id,
videos: videos
})

if (videos != null) {
this.updateSubscriptionVideosCacheByChannel({
channelId: channel.id,
videos: videos
})
}

if (name || thumbnailUrl) {
subscriptionUpdates.push({
Expand All @@ -223,7 +226,7 @@ export default defineComponent({
})
}

return videos
return videos ?? []
}))).flat()

this.videoList = updateVideoListAfterProcessing(videoListFromRemote)
Expand Down Expand Up @@ -281,6 +284,12 @@ export default defineComponent({
try {
const response = await fetch(feedUrl)

if (response.status === 403) {
return {
videos: null
}
}

if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
// so we need to check the channel feed too before deciding it errored, as that only 404s if the channel was terminated
Expand Down