fix(failover): require a sustained stream before failing back to a recovered input#33
Merged
Merged
Conversation
…covered input The failback probe declared a degraded input "recovered" on a single payload packet from one read. An intermittent source that merely sputters (an occasional packet while effectively down) passed that check, so the manager failed back to it, then starved to the packet-timeout and degraded again — flapping between the source and its backup roughly every timeout window, and the repeated input switches churned ingest sessions into visible playback flicker on recovery. Probe now requires payload to keep arriving across a minimum span (1.5s), with a minimum packet count and byte total, before reporting recovery. A sputtering feed never reaches the span and stays degraded; a genuinely recovered source streams continuously and is adopted once. The manager's probe deadline is raised to 5s to fit the sustained window.
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
The failback probe declared a degraded input "recovered" on a single payload packet from one read. An intermittent source that merely sputters (an occasional packet while effectively down) passed that check, so the manager failed back to it, then starved to the packet-timeout and degraded again — flapping between the source and its backup roughly every timeout window. The repeated input switches also churned ingest sessions into visible playback flicker on recovery.
Fix
ingestor.Probenow requires payload to keep arriving across a minimum span (1.5s), with a minimum packet count and byte total, before reporting recovery:The manager's probe deadline is raised from 3s to 5s to fit the sustained window.
Changes
internal/ingestor/service.go— sustained-probe logic (probeStatsaccumulator +sustainedProbeOK);Probereads until sustained or ctx expires.internal/manager/service.go—probeTimeout3s → 5s.internal/ingestor/probe_test.go— table tests (silent / single blip / sparse blips / burst-then-quiet / sustained / boundaries).Testing
go build,go vet,gofumpt,golangci-lint run ./...→ cleango test ./internal/ingestor/ ./internal/manager/→ pass (only the pre-existing MediaMTX docker integration test iningestor/pullfails, unrelated and untouched)