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

Function retryAsync

scripts/integration/android.mjs:808–828  ·  view source on GitHub ↗
(run, label, options = {})

Source from the content-addressed store, hash-verified

806}
807
808async function retryAsync(run, label, options = {}) {
809 const attempts = options.attempts ?? 3;
810 const delayMs = options.delayMs ?? 1_000;
811 let lastError = null;
812 for (let attempt = 1; attempt <= attempts; attempt += 1) {
813 try {
814 return await run();
815 } catch (error) {
816 lastError = error;
817 if (attempt < attempts) {
818 if (verbose) {
819 console.log(
820 `${label} attempt ${attempt}/${attempts} failed: ${error.message}`,
821 );
822 }
823 await sleep(delayMs);
824 }
825 }
826 }
827 throw lastError;
828}
829
830function printTimingSummary() {
831 if (!verbose || stepTimings.length === 0) {

Callers 2

runCliSurfaceFunction · 0.70
runJsSurfaceFunction · 0.70

Calls 3

logMethod · 0.80
runFunction · 0.70
sleepFunction · 0.70

Tested by

no test coverage detected