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
@@ -27,9 +27,9 @@ export default async function StaffPage() {
|
||||
const minStaffRank =
|
||||
Number(await siteSettings.get("min_staff_rank", "7")) || 7;
|
||||
|
||||
let staff: StaffMember[] = [];
|
||||
try {
|
||||
staff = await db
|
||||
// Independent queries — staff members and teams load concurrently.
|
||||
const [staff, teams] = await Promise.all([
|
||||
db
|
||||
.select({
|
||||
username: User.username,
|
||||
look: User.look,
|
||||
@@ -39,14 +39,9 @@ export default async function StaffPage() {
|
||||
.from(User)
|
||||
.where(gte(User.rank, minStaffRank))
|
||||
.orderBy(desc(User.rank), asc(User.username))
|
||||
.limit(100);
|
||||
} catch {
|
||||
staff = [];
|
||||
}
|
||||
|
||||
let teams: Team[] = [];
|
||||
try {
|
||||
const rows = await db
|
||||
.limit(100)
|
||||
.catch((): StaffMember[] => []),
|
||||
db
|
||||
.select({
|
||||
id: WebsiteTeams.id,
|
||||
rankName: WebsiteTeams.rankName,
|
||||
@@ -56,11 +51,10 @@ export default async function StaffPage() {
|
||||
})
|
||||
.from(WebsiteTeams)
|
||||
.where(eq(WebsiteTeams.hiddenRank, false))
|
||||
.orderBy(asc(WebsiteTeams.id));
|
||||
teams = rows.map((row) => ({ ...row, id: String(row.id) }));
|
||||
} catch {
|
||||
teams = [];
|
||||
}
|
||||
.orderBy(asc(WebsiteTeams.id))
|
||||
.then((rows) => rows.map((row) => ({ ...row, id: String(row.id) })))
|
||||
.catch((): Team[] => []),
|
||||
]);
|
||||
|
||||
return (
|
||||
<main style={{ display: "grid", gap: "1.5rem" }}>
|
||||
|
||||
Reference in new issue
Block a user