MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / retrySync

Function retrySync

scripts/integration/js-api.mjs:636–651  ·  view source on GitHub ↗
(fn, label, attempts, delayMs)

Source from the content-addressed store, hash-verified

634}
635
636function retrySync(fn, label, attempts, delayMs) {
637 let lastError;
638 for (let attempt = 1; attempt <= attempts; attempt += 1) {
639 try {
640 return fn();
641 } catch (error) {
642 lastError = error;
643 if (attempt < attempts) {
644 sleepSync(delayMs);
645 }
646 }
647 }
648 throw new Error(
649 `${label} failed after ${attempts} attempts: ${lastError?.message ?? lastError}`,
650 );
651}
652
653async function measuredStep(label, fn, options = {}) {
654 const parentTiming = activeTiming;

Callers 1

eraseSimulatorReliablyFunction · 0.85

Calls 1

sleepSyncFunction · 0.85

Tested by

no test coverage detected