Repository navigation
Keep Twitch ingest urls when the ingest list is unavailable - #1475
RaphaelFakhri wants to merge 1 commit into
Conversation
| parsed = rawUrl | ||
| if updated, err := o.updateTwitchURL(match[1]); err == nil { | ||
| parsed = updated | ||
| } |
There was a problem hiding this comment.
🔴 Twitch stream removal fails after recovery
When the ingest list recovers after a raw URL was added, GetStream rewrites that URL before lookup. AddStream stored the raw URL while the list was unavailable, so UpdateStream cannot remove the running stream.
Learn more
A stream is stored in Streams under its parsed URL by AddStream. During an ingest-list outage, the new fallback uses the original URL as that key. Once the list recovers, GetStream resolves the same URL to the ingest template and looks up a different key. UpdateStream then reports stream not found and leaves the output running.
Example: Add rtmp://lax.contribute.live-video.net/app/key during an outage; it is stored under that exact URL. When the ingest list becomes available and selects rtmps://other.contribute.live-video.net/app/{stream_key}, removing the original URL looks for rtmps://other.contribute.live-video.net/app/key instead.
Recommended fix: Preserve a stable mapping from submitted URLs to stored streams, or check for a stored raw URL before attempting the ingest rewrite in GetStream. Test the outage-to-recovery transition using a controlled HTTP transport.
Was this helpful? React with 👍 or 👎 to provide feedback.
Problem
For an RTMP url that points at a Twitch ingest server (
rtmp(s)://*.contribute.live-video.net/app/{stream_key}),ValidateUrlrewrites the url with the template fromhttps://ingest.twitch.tv/ingests. If that request fails, the url is meant to be used as given. Since the stream logic cleanup in #754,parsedis only assigned on success, so it stays empty andredactStreamKey("")rejects the request with:The url is valid and works without the rewrite, but the egress, or the
UpdateStreamcall that adds it, fails whenever the egress host cannot reach the Twitch ingest list.GetStreamhas the same dependency and returns the http error, so the url cannot be removed withUpdateStreameither.Change
ValidateUrlstarts from the raw url for Twitch ingest urls and replaces it only when the ingest template is available, as it did before Clean up stream logic #754.GetStreamresolves Twitch ingest urls the same way, so a stream added from the raw url can still be found and removed.twitch://urls are unchanged: they have no server to fall back to, so they still return the error.Testing
TestTwitchEndpointWithoutIngestListmakes the ingest list request fail, then validates, adds and looks up a Twitch ingest url. Without the fix it fails with the error above. With the fix it passes.Fixes #1474