Skip to content

Commit 36e3f9a

Browse files
committed
fix: don't time out during config upload
1 parent 224c920 commit 36e3f9a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/maintenance/upload.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void (async () => {
3232
!file.endsWith("index.json") &&
3333
!path.basename(file).startsWith("_") &&
3434
!file.includes("/templates/") &&
35-
!file.includes("\\templates\\")
35+
!file.includes("\\templates\\"),
3636
);
3737

3838
const files: { filename: string; data: string }[] = [];
@@ -69,14 +69,15 @@ void (async () => {
6969
await ky.post(new URL("/admin/config/upload", baseURL).toString(), {
7070
headers: { "x-admin-secret": adminSecret },
7171
json: createPayload,
72+
timeout: false,
7273
});
7374

7475
let cursor = 0;
7576

7677
while (cursor < files.length) {
7778
const currentBatch = files.slice(
7879
cursor,
79-
cursor + MAX_FILES_PER_REQUEST
80+
cursor + MAX_FILES_PER_REQUEST,
8081
);
8182

8283
const payload: UploadPayload = {
@@ -89,11 +90,12 @@ void (async () => {
8990
console.log(
9091
`Uploading files ${cursor + 1}...${
9192
cursor + currentBatch.length
92-
} of ${files.length}...`
93+
} of ${files.length}...`,
9394
);
9495
await ky.post(new URL("/admin/config/upload", baseURL).toString(), {
9596
headers: { "x-admin-secret": adminSecret },
9697
json: payload,
98+
timeout: false,
9799
});
98100

99101
cursor += MAX_FILES_PER_REQUEST;
@@ -107,6 +109,7 @@ void (async () => {
107109
await ky.post(new URL("/admin/config/upload", baseURL).toString(), {
108110
headers: { "x-admin-secret": adminSecret },
109111
json: finalizePayload,
112+
timeout: false,
110113
});
111114
console.log("done!");
112115
})();

0 commit comments

Comments
 (0)