Skip to content

Commit a7961ce

Browse files
authored
fix: timeouts on doc:upload (#1227)
## 🧰 Changes We've been running into issues with `doc:upload` calls processing 6 pages and then failing out with undici timeout errors despite no actual request ever happening. I don't really know what's going on with the `allSettled` or undici and why it's consistently failing but reworking `doc:upload` to process each page in the batch one by one resolves our issues (albeit at the expensive of making the command slower).
1 parent c40dea6 commit a7961ce

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/lib/readmeAPIFetch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ export async function readmeAPIv2Fetch<T extends Hook.Context = Hook.Context>(
325325
})
326326
.catch(e => {
327327
this.debug(`error making fetch request: ${e}`);
328+
this.debug(e.stack);
328329
throw e;
329330
});
330331
}

src/lib/syncPagePath.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,21 @@ export default async function syncPagePath(this: APIv2PageCommands) {
290290
const sortedFiles = sortFiles((unsortedFiles as PageMetadata<PageRepresentation>[]).sort(byParentPage));
291291

292292
// push the files to ReadMe
293-
const rawResults = await Promise.allSettled(sortedFiles.map(async fileData => pushPage.call(this, fileData)));
293+
const rawResults: PromiseSettledResult<PushResult>[] = [];
294+
for await (const fileData of sortedFiles) {
295+
try {
296+
const res = await pushPage.call(this, fileData);
297+
rawResults.push({
298+
status: 'fulfilled',
299+
value: res,
300+
});
301+
} catch (err) {
302+
rawResults.push({
303+
status: 'rejected',
304+
reason: err,
305+
});
306+
}
307+
}
294308

295309
const results = rawResults.reduce<{
296310
created: PushResult[];

0 commit comments

Comments
 (0)