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

Function ghTextWithRetry

src/repair/github-cli.ts:153–167  ·  view source on GitHub ↗
(ghArgs: string[], options: GhRetryOptions | number = {})

Source from the content-addressed store, hash-verified

151}
152
153export function ghTextWithRetry(ghArgs: string[], options: GhRetryOptions | number = {}): string {
154 const resolved = resolveRetryOptions(options);
155 const attempts = Math.max(1, resolved.attempts ?? 6);
156 let lastError: unknown;
157 for (let attempt = 1; attempt <= attempts; attempt += 1) {
158 try {
159 return ghText(ghArgs, resolved);
160 } catch (error) {
161 lastError = error;
162 if (attempt >= attempts || !shouldRetryGh(error)) throw error;
163 sleepMs(Math.min(1000 * attempt, 5000));
164 }
165 }
166 throw lastError instanceof Error ? lastError : new Error(String(lastError));
167}
168
169export async function ghTextWithRetryAsync(
170 ghArgs: string[],

Callers 5

ghJsonWithRetryFunction · 0.85
ghBestEffortWithRetryFunction · 0.85
labelTargetFunction · 0.85
createGithubLabelFunction · 0.85
removeLabelsFunction · 0.85

Calls 4

resolveRetryOptionsFunction · 0.85
ghTextFunction · 0.85
shouldRetryGhFunction · 0.70
sleepMsFunction · 0.70

Tested by

no test coverage detected