Fix: HTTP raw stream resolution reliability (timeouts + optimistic fallback)#197
Open
Walkoud wants to merge 1 commit intoPerformanC:devfrom
Open
Fix: HTTP raw stream resolution reliability (timeouts + optimistic fallback)#197Walkoud wants to merge 1 commit intoPerformanC:devfrom
Walkoud wants to merge 1 commit intoPerformanC:devfrom
Conversation
Add a settled flag and resolveOnce/rejectOnce wrappers to ensure HTTP request promises are settled only once, preventing multiple resolve/reject calls. Implement a hard timeout mechanism that destroys the request after timeout, even if the request timeout event does not fire. Add configurable resolve and head timeouts with fallback to optimistic track creation on probe failures to improve streaming URL reliability.
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
This PR improves NodeLink HTTP source reliability for raw radio streams (for example
http://.../stream) that may not answer consistently toHEADor may exceed worker timeout budgets.The goal is to prevent
loadtracksfailures/timeouts and return a playable track whenever possible.Problem
loadtrackscould fail when probe requests (HEADthen fallbackGET) consumed too much time.Changes
1) HTTP source timeout budgeting and safer probing
File:
src/sources/http.jssources.http:resolveTimeoutMs(default7000)headTimeoutMs(default2500)optimisticOnProbeFailure(defaulttrue)cluster.commandTimeout(with safety margin).GETprobe uses remaining timeout budget only.Icy-MetaData: 1on fallback probe to better handle radio/ICY endpoints.2) Hard timeout enforcement for low-level HTTP requests
File:
src/utils.jsresolveOnce/rejectOnce) for safer promise completion in request/error/timeout races.Why this works
Validation
Syntax checks
node --check src/sources/http.jsnode --check src/utils.jsRuntime verification
GET /v4/loadtracks?identifier=http://144.24.202.161:25509/streamloadType: "track"returned successfullysourceName: "http"presentBackward compatibility
Notes
logging.levelandlogging.debug.*), not by this PR.Checklist
loadtracksbehavior