Repository navigation
feat: Refresh PO tokens which are not accepted - #10151
Open
FishDomination wants to merge 2 commits into
Open
FishDomination wants to merge 2 commits into
FishDomination wants to merge 2 commits into
Conversation
FishDomination
requested review from
PikachuEXE,
absidue and
radmorecameron
as code owners
November 20, 2026 22:20
FreeTubeBot
enabled auto-merge (squash)
November 20, 2026 22:20
Shadorc
reviewed
Nov 20, 2026
| if (!streamProtectionStatus) break | ||
|
|
||
| if (streamProtectionStatus.status === 2 || streamProtectionStatus.status === 3) { | ||
| refreshPoTokenFor(currentState) |
Contributor
There was a problem hiding this comment.
refreshPoTokenFor is a promise, if streamProtectionStatus.status=3 it will also set invalidPoToken = true, no matter where the execution of refreshPoTokenFor is
Is it intended?
Author
There was a problem hiding this comment.
No, i missed that. I moved the refresh call into the retry block. The call happening in the reader was also not optimal.
On thing my fixup changed is that it expects only 1 stream protection status per response. My tests never showed more than one in a response, can you confirm that holds?
auto-merge was automatically disabled
November 21, 2026 09:57
Head branch was pushed to by a user without write access
FreeTubeBot
enabled auto-merge (squash)
November 21, 2026 09:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Related issue
closes #10024
closes #10090
#7921 (maybe?)
Description
When using a VPN Youtube frequently does not accept the generated PO Token. This causes the player to spam retry until the server sends a backoff timeout which then loops up to 3 times before the player reloads and a new token is generated. All these reloads are unnecessary because the PO token is already rejected.
This change adds an additional token refresh as soon as a request is rejected. It also waits in the retries until the new token is generated.
I also lowered the max retry count to 20 from 100 because i once saw while debugging that over 50 requests were sent in ~2 seconds.
I ran a local build with this change a few days and i notice almost zero player reloads and when then at most once. "Remaining SABR Backoff" Toasts still popt up on most videos.
Before i sometimes had to switch vpn servers because videos were stuck in a SABR Toast and player reload loop.
Testing
Desktop