Improve application responsiveness and background processing
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { leaderboardReport } from '$lib/server/reports/index.js';
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { getLeaderboard, isLeaderboardMetric, MAX_LEADERBOARD_OFFSET } from '$lib/server/fleet/leaderboard.js';
|
||||
import { isLeaderboardMetric, MAX_LEADERBOARD_OFFSET } from '$lib/server/fleet/leaderboard.js';
|
||||
|
||||
export function GET({ url }: { url: URL }) {
|
||||
export async function GET({ url }: { url: URL }) {
|
||||
const params = url.searchParams;
|
||||
const game = params.get('game');
|
||||
const map = params.get('map');
|
||||
@@ -20,7 +21,7 @@ export function GET({ url }: { url: URL }) {
|
||||
|| !Number.isFinite(offset) || offset < 0 || offset > MAX_LEADERBOARD_OFFSET) {
|
||||
return json({ ok: false, kind: 'bad-request', error: 'Use game t5 or t6, a supported metric, map key up to 1024 characters, q up to 100 characters, limit 1–100, and offset 0–1000000.' }, { status: 400 });
|
||||
}
|
||||
return json(getLeaderboard({ game: game ?? undefined, map: map || undefined,
|
||||
return json(await leaderboardReport({ game: game ?? undefined, map: map || undefined,
|
||||
metric: metric !== null && isLeaderboardMetric(metric) ? metric : undefined,
|
||||
q: q ?? undefined, limit, offset }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user