Skip to content

Commit eed48eb

Browse files
committed
fix(config): remove concurrent fetch calls causing Workers request limit errors
1 parent 6c4156f commit eed48eb

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

src/routes/[username]/[slug]/+page.server.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,6 @@ export const load: PageServerLoad = async ({ params, platform, request, cookies
4545
? config.packages.map((p: any) => typeof p === 'string' ? {name: p, type: 'formula'} : p)
4646
: [];
4747

48-
const missing = pkgs.filter(p => !p.desc);
49-
if (missing.length > 0) {
50-
const descResults = await Promise.allSettled(
51-
missing.map(async (p) => {
52-
try {
53-
if (p.type === 'npm') {
54-
const r = await fetch(`https://registry.npmjs.org/${p.name}`, { cf: { cacheTtl: 86400, cacheEverything: true } } as RequestInit);
55-
if (r.ok) { const d = await r.json() as any; return { name: p.name, desc: d.description || '' }; }
56-
} else {
57-
const kind = p.type === 'cask' ? 'cask' : 'formula';
58-
const r = await fetch(`https://formulae.brew.sh/api/${kind}/${p.name}.json`, { cf: { cacheTtl: 86400, cacheEverything: true } } as RequestInit);
59-
if (r.ok) { const d = await r.json() as any; return { name: p.name, desc: d.desc || '' }; }
60-
}
61-
} catch {}
62-
return { name: p.name, desc: '' };
63-
})
64-
);
65-
for (const r of descResults) {
66-
if (r.status === 'fulfilled' && r.value && r.value.desc) {
67-
const pkg = pkgs.find(p => p.name === r.value.name);
68-
if (pkg) pkg.desc = r.value.desc;
69-
}
70-
}
71-
}
72-
7348
const packageDescriptions: Record<string, string> = {};
7449
for (const p of pkgs) {
7550
if (p.desc) packageDescriptions[p.name] = p.desc;

0 commit comments

Comments
 (0)