MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / uploadOnePartWithRetry

Function uploadOnePartWithRetry

apps/kimi-code/src/feedback/upload.ts:125–142  ·  view source on GitHub ↗
(
  filePath: string,
  layout: PartLayout,
  options: UploadArchiveOptions,
)

Source from the content-addressed store, hash-verified

123}
124
125async function uploadOnePartWithRetry(
126 filePath: string,
127 layout: PartLayout,
128 options: UploadArchiveOptions,
129): Promise<CompletedUploadPart> {
130 const maxRetries = Math.max(0, options.maxRetries ?? DEFAULT_MAX_RETRIES);
131 let lastError: unknown;
132 for (let attempt = 0; attempt <= maxRetries; attempt += 1) {
133 try {
134 return await uploadOnePart(filePath, layout, options);
135 } catch (error) {
136 lastError = error;
137 if (attempt === maxRetries || !isRetryable(error)) break;
138 await sleep(RETRY_BASE_DELAY_MS * 2 ** attempt);
139 }
140 }
141 throw lastError;
142}
143
144async function uploadOnePart(
145 filePath: string,

Callers 1

workerFunction · 0.85

Calls 3

uploadOnePartFunction · 0.85
isRetryableFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected