Add performance optimizations and component refactors
- Cache read-heavy public API routes via redisCache (leaderboard, values, shop, articles, photos, guilds, teams, staff, users, home, radio, badges) - Add single-flight and bounded-memory cache layer with unit tests - Parallelize independent DB queries on search, rares, shop, staff, polls and profile pages - Push radio points leaderboard aggregation to SQL with a LIMIT - Split studio-client and import-furni-client into focused modules - Clean up next.config.ts
This commit is contained in:
1 parent
54f2bc5e0c
commit
f285a7cd98
42 files changed
+1616
-1205
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
} from "@/components/public/ui";
|
||||
import { CurrencyIcon } from "@/components/shared/currency-icon";
|
||||
import { UserAvatarThumbnail } from "@/components/shared/user-avatar-thumbnail";
|
||||
import { cached } from "@/lib/cache";
|
||||
import { db, User } from "@/lib/db";
|
||||
|
||||
export const metadata = { title: "Rankings" };
|
||||
@@ -25,17 +26,19 @@ export default async function RankingsPage() {
|
||||
const t = await getTranslations("pages.rankings");
|
||||
let users: TopUser[] = [];
|
||||
try {
|
||||
users = await db
|
||||
.select({
|
||||
username: User.username,
|
||||
look: User.look,
|
||||
credits: User.credits,
|
||||
rank: User.rank,
|
||||
online: User.online,
|
||||
})
|
||||
.from(User)
|
||||
.orderBy(desc(User.credits))
|
||||
.limit(12);
|
||||
users = await cached("rankings:top", 60_000, async () =>
|
||||
db
|
||||
.select({
|
||||
username: User.username,
|
||||
look: User.look,
|
||||
credits: User.credits,
|
||||
rank: User.rank,
|
||||
online: User.online,
|
||||
})
|
||||
.from(User)
|
||||
.orderBy(desc(User.credits))
|
||||
.limit(12),
|
||||
);
|
||||
} catch {
|
||||
users = [];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user