Compare commits
No commits in common. "b2078690bde33471955df0a03895a1c3e5f6013f" and "27e1caf1a6b687fd5742c03286c7a72321d41252" have entirely different histories.
b2078690bd
...
27e1caf1a6
2 changed files with 3 additions and 8 deletions
|
|
@ -21,9 +21,6 @@ async function solve(flaresolverrUrl, targetUrl, opts = {}) {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
// FlareSolverr is told to give up at maxTimeout; if it doesn't answer
|
|
||||||
// even then, stop waiting rather than hanging the request for ever.
|
|
||||||
signal: AbortSignal.timeout((opts.maxTimeout || 60000) + 15000),
|
|
||||||
});
|
});
|
||||||
if (res.status >= 500) { lastErr = new Error(`FlareSolverr HTTP ${res.status}`); continue; }
|
if (res.status >= 500) { lastErr = new Error(`FlareSolverr HTTP ${res.status}`); continue; }
|
||||||
if (!res.ok) throw new Error(`FlareSolverr HTTP ${res.status}`);
|
if (!res.ok) throw new Error(`FlareSolverr HTTP ${res.status}`);
|
||||||
|
|
@ -32,7 +29,7 @@ async function solve(flaresolverrUrl, targetUrl, opts = {}) {
|
||||||
return data.solution.response;
|
return data.solution.response;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
lastErr = err;
|
lastErr = err;
|
||||||
if (!/HTTP 5\d\d|fetch failed|ECONNRESET|network|timeout|aborted/i.test(err.message)) throw err;
|
if (!/HTTP 5\d\d|fetch failed|ECONNRESET|network/i.test(err.message)) throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw lastErr;
|
throw lastErr;
|
||||||
|
|
|
||||||
|
|
@ -993,8 +993,7 @@ async function downloadMakerworldFiles(html, skipNames = new Set()) {
|
||||||
}
|
}
|
||||||
const original = dl.name || `instance-${inst.id}.3mf`;
|
const original = dl.name || `instance-${inst.id}.3mf`;
|
||||||
if (skipNames.has(original)) continue;
|
if (skipNames.has(original)) continue;
|
||||||
// A stalled CDN connection would otherwise hang the download for ever.
|
const resp = await fetch(dl.url);
|
||||||
const resp = await fetch(dl.url, { signal: AbortSignal.timeout(180000) });
|
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
console.warn(`MakerWorld CDN download ${resp.status} for ${original}`);
|
console.warn(`MakerWorld CDN download ${resp.status} for ${original}`);
|
||||||
problems.push({ message: `Downloading ${original} from MakerWorld failed (HTTP ${resp.status})` });
|
problems.push({ message: `Downloading ${original} from MakerWorld failed (HTTP ${resp.status})` });
|
||||||
|
|
@ -1065,8 +1064,7 @@ async function downloadThingiverseFiles(meta, skipNames = new Set()) {
|
||||||
for (const dl of meta.downloads) {
|
for (const dl of meta.downloads) {
|
||||||
if (!fileProcessor.isAllowed(dl.name)) continue; // skip readmes/images
|
if (!fileProcessor.isAllowed(dl.name)) continue; // skip readmes/images
|
||||||
if (skipNames.has(dl.name)) continue;
|
if (skipNames.has(dl.name)) continue;
|
||||||
// A stalled CDN connection would otherwise hang the download for ever.
|
const resp = await fetch(dl.url);
|
||||||
const resp = await fetch(dl.url, { signal: AbortSignal.timeout(180000) });
|
|
||||||
if (!resp.ok) { console.error(`Download failed (${resp.status}): ${dl.name}`); continue; }
|
if (!resp.ok) { console.error(`Download failed (${resp.status}): ${dl.name}`); continue; }
|
||||||
const buffer = Buffer.from(await resp.arrayBuffer());
|
const buffer = Buffer.from(await resp.arrayBuffer());
|
||||||
const fileName = uniqueName(dl.name);
|
const fileName = uniqueName(dl.name);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue