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