MCPcopy Create free account
hub / github.com/nukeop/nuclear / tryNext

Function tryNext

packages/player/src/hooks/useStreamResolution.ts:142–161  ·  view source on GitHub ↗
(
    remaining: StreamCandidate[],
  )

Source from the content-addressed store, hash-verified

140 signal: AbortSignal,
141): Promise<StreamCandidate | undefined> => {
142 const tryNext = async (
143 remaining: StreamCandidate[],
144 ): Promise<StreamCandidate | undefined> => {
145 if (signal.aborted) {
146 return undefined;
147 }
148
149 const result = await tryResolveNextCandidate(remaining);
150 if (!result) {
151 return undefined;
152 }
153
154 updateItemCandidates(item, result.updated);
155
156 if (result.resolved.stream && !result.resolved.failed) {
157 return result.resolved;
158 }
159
160 return tryNext(result.updated);
161 };
162
163 return tryNext(candidates);
164};

Callers 1

Calls 2

tryResolveNextCandidateFunction · 0.85
updateItemCandidatesFunction · 0.85

Tested by

no test coverage detected