diff --git a/source/routes/problems/slowImage.ts b/source/routes/problems/slowImage.ts index 717f35d..63e60dd 100644 --- a/source/routes/problems/slowImage.ts +++ b/source/routes/problems/slowImage.ts @@ -1,11 +1,11 @@ -import type { FastifyPluginAsync } from 'fastify'; -import { performance } from 'node:perf_hooks'; -import { slowImageGeneration } from '~/simulate/load.ts'; +import type { FastifyPluginAsync } from 'fastify' +import { performance } from 'node:perf_hooks' +import { slowImageGeneration } from '~/simulate/load.ts' // eslint-disable-next-line jsdoc/require-jsdoc export const slowImage: FastifyPluginAsync = async (fastify) => { - fastify.get<{ Querystring: { complexity: string, name: string } }>('/problems/slow-image', async (request, reply) => { - const complexity = parseInt(request.query.complexity || '1', 10) + fastify.get<{ Querystring: { complexity: string; name: string } }>('/problems/slow-image', async (request, reply) => { + const complexity = Number.parseInt(request.query.complexity || '1', 10) const name = request.query.name || 'default' const startTime = performance.now() diff --git a/source/routes/problems/slowImageGallery.ts b/source/routes/problems/slowImageGallery.ts index 6f73417..1f0a84d 100644 --- a/source/routes/problems/slowImageGallery.ts +++ b/source/routes/problems/slowImageGallery.ts @@ -3,6 +3,20 @@ import type { FastifyPluginAsync } from 'fastify' // eslint-disable-next-line jsdoc/require-jsdoc export const imageGalleryRoute: FastifyPluginAsync = async (fastify) => { fastify.get('/problems/slow-image-gallery', async (_, reply) => { + const imageContainer = (i: number): string => { + return ` +
+
Loading...
+ Slow image ${i} +
+ ` + } + + const gallery = Array.from({ length: 9 }) + .map((_, i) => i + 1) + .map((i) => imageContainer(i)) + .join('') + const html = ` @@ -21,12 +35,7 @@ export const imageGalleryRoute: FastifyPluginAsync = async (fastify) => {

Slow Loading Image Gallery