nest: improve stream extension resilience and token refresh#2128
Open
PrutsMeneer wants to merge 1 commit intoAlexxIT:masterfrom
Open
nest: improve stream extension resilience and token refresh#2128PrutsMeneer wants to merge 1 commit intoAlexxIT:masterfrom
PrutsMeneer wants to merge 1 commit intoAlexxIT:masterfrom
Conversation
Author
|
bug at: #2108 |
MechanicalCoderX
added a commit
to MechanicalCoderX/go2rtc
that referenced
this pull request
Mar 28, 2026
StartExtendStreamTimer used a one-shot timer that fired once at T+4min, extended the stream for another 5 minutes, then exited — leaving no timer running for subsequent extensions. The stream expired at ~10 minutes and required a full WebRTC reconnect every cycle. Replace the one-shot timer with a continuous goroutine loop that reschedules itself from the updated StreamExpiresAt after each extend, keeping the stream alive indefinitely. The loop also continues on transient errors rather than stopping, preventing avoidable expiry. Also adds retry logic to ExtendStream (401 → token refresh, 409/429 → exponential backoff) and stores OAuth credentials on the API struct so refreshToken() works correctly after the first token rotation. Fixes AlexxIT#2108, mirrors approach from PR AlexxIT#2128. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Why
When stream extension fails once, the stream can expire and streams reconnect starts ([streams] retry=...). These changes reduce avoidable drops by improving retry and refresh behavior.
Testing