MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / launchFixtureWithRecovery

Function launchFixtureWithRecovery

scripts/integration/webrtc.mjs:199–256  ·  view source on GitHub ↗
(appPath, options = {})

Source from the content-addressed store, hash-verified

197}
198
199async function launchFixtureWithRecovery(appPath, options = {}) {
200 const recoveryCount = options.recoveryCount ?? 0;
201 const maxRecoveries = options.maxRecoveries ?? fixtureLaunchMaxRecoveries;
202
203 simdeckJson(["install", simulatorUDID, appPath], {
204 timeoutMs: 60_000,
205 });
206
207 let launchError = null;
208 try {
209 simdeckJson(["launch", simulatorUDID, fixtureBundleId], {
210 timeoutMs: 180_000,
211 });
212 } catch (error) {
213 launchError = error;
214 }
215
216 let urlError = null;
217 if (launchError === null) {
218 try {
219 await retrySimdeckJson(
220 ["open-url", simulatorUDID, fixtureAnimateUrl],
221 "WebRTC start fixture animation",
222 {
223 attempts: 3,
224 delayMs: 5_000,
225 timeoutMs: 180_000,
226 },
227 );
228 return;
229 } catch (error) {
230 urlError = error;
231 }
232 }
233
234 if (
235 !shouldRecycleSimulatorForFixtureLaunch({
236 launchError,
237 urlError,
238 recoveryCount,
239 maxRecoveries,
240 })
241 ) {
242 throw urlError ?? launchError;
243 }
244
245 console.warn(
246 `WebRTC fixture activation hit ${activationRecoveryReason({
247 launchError,
248 urlError,
249 })}; recycling simulator and retrying once.`,
250 );
251 await recycleSimulatorForFixtureLaunch();
252 return launchFixtureWithRecovery(appPath, {
253 recoveryCount: recoveryCount + 1,
254 maxRecoveries,
255 });
256}

Callers 1

mainFunction · 0.85

Calls 6

activationRecoveryReasonFunction · 0.90
warnMethod · 0.80
simdeckJsonFunction · 0.70
retrySimdeckJsonFunction · 0.70

Tested by

no test coverage detected