( state: SyncState, repoSlug: string, etag?: string | null, )
| 385 | } |
| 386 | |
| 387 | async function fetchTeamMemory( |
| 388 | state: SyncState, |
| 389 | repoSlug: string, |
| 390 | etag?: string | null, |
| 391 | ): Promise<TeamMemorySyncFetchResult> { |
| 392 | let lastResult: TeamMemorySyncFetchResult | null = null |
| 393 | |
| 394 | for (let attempt = 1; attempt <= MAX_RETRIES + 1; attempt++) { |
| 395 | lastResult = await fetchTeamMemoryOnce(state, repoSlug, etag) |
| 396 | if (lastResult.success || lastResult.skipRetry) { |
| 397 | return lastResult |
| 398 | } |
| 399 | if (attempt > MAX_RETRIES) { |
| 400 | return lastResult |
| 401 | } |
| 402 | const delayMs = getRetryDelay(attempt) |
| 403 | logForDebugging(`team-memory-sync: retry ${attempt}/${MAX_RETRIES}`, { |
| 404 | level: 'debug', |
| 405 | }) |
| 406 | await sleep(delayMs) |
| 407 | } |
| 408 | |
| 409 | return lastResult! |
| 410 | } |
| 411 | |
| 412 | // ─── Upload (push) ─────────────────────────────────────────── |
| 413 |
no test coverage detected