using batching to mitigate startup request cost

This commit is contained in:
2024-11-08 16:53:56 -07:00
parent c47d7405c2
commit cc8d004aa4
5 changed files with 14 additions and 33 deletions

View File

@@ -52,6 +52,13 @@ async function DataHydration({
router: trpcAppRouter,
ctx: createTrpcContext(),
transformer: superjson,
queryClientConfig: {
defaultOptions: {
queries: {
staleTime: Infinity,
},
},
},
});
const allSettings = await fileStorageService.settings.getAllCoursesSettings();
await Promise.all(
@@ -63,7 +70,7 @@ async function DataHydration({
await Promise.all(
moduleNames.map(
async (moduleName) =>
await trpcHelper.assignment.getAllAssignments.prefetch({
await trpcHelper.assignment.getAllAssignments.fetch({
courseName,
moduleName,
})
@@ -75,7 +82,7 @@ async function DataHydration({
await Promise.all(
allSettings.map(
async (settings) =>
await trpcHelper.lectures.getLectures.prefetch({
await trpcHelper.lectures.getLectures.fetch({
courseName: settings.name,
})
)