MCPcopy
hub / github.com/openclaw/clawsweeper / ghRawWithRetry

Function ghRawWithRetry

src/clawsweeper.ts:2109–2126  ·  view source on GitHub ↗
(args: string[], attempts = 12)

Source from the content-addressed store, hash-verified

2107}
2108
2109function ghRawWithRetry(args: string[], attempts = 12): string {
2110 let lastError: unknown;
2111 for (let attempt = 0; attempt < attempts; attempt += 1) {
2112 try {
2113 return run("gh", args);
2114 } catch (error) {
2115 lastError = error;
2116 const retryKind = ghRetryKind(error);
2117 if (retryKind === "none" || attempt === attempts - 1) throw error;
2118 const waitMs = ghRetryWaitMs(retryKind, attempt);
2119 console.error(
2120 `Transient GitHub workflow dispatch failure; retrying ${summarizeGhArgs(args)} in ${Math.round(waitMs / 1000)}s`,
2121 );
2122 sleepMs(waitMs);
2123 }
2124 }
2125 throw lastError;
2126}
2127
2128function ghJson<T>(args: string[]): T {
2129 return parseGhJson<T>(ghWithRetry(args), args);

Callers 1

Calls 5

ghRetryKindFunction · 0.85
ghRetryWaitMsFunction · 0.85
summarizeGhArgsFunction · 0.85
runFunction · 0.70
sleepMsFunction · 0.70

Tested by

no test coverage detected