perf: parallelize database queries (resolves #5)
Commit / ci (push) Successful in 10m40s
PullRequest / publish (pull_request) Failing after 2m23s

This commit is contained in:
2026-04-03 13:06:33 +02:00
parent 2e16cf9d51
commit 16248416e7
+10 -9
View File
@@ -9,15 +9,16 @@ import * as v from 'valibot';
import { resolve } from '$app/paths'; import { resolve } from '$app/paths';
export const load: PageServerLoad = async (event) => { export const load: PageServerLoad = async (event) => {
const akti = await db.query.aktis.findFirst({ const [akti, r] = await Promise.all([
where: eq(aktis.id, event.params.aktiId), db.query.aktis.findFirst({
with: { author: true } where: eq(aktis.id, event.params.aktiId),
}); with: { author: true }
}),
const r = await db.query.ratings.findMany({ db.query.ratings.findMany({
with: { user: true }, with: { user: true },
where: eq(ratings.aktiId, event.params.aktiId) where: eq(ratings.aktiId, event.params.aktiId)
}); })
]);
if (!akti) { if (!akti) {
error(404, { message: 'Die Akti gits garnid, sorry...' }); error(404, { message: 'Die Akti gits garnid, sorry...' });