Add performance optimizations and component refactors
CI / check (push) Successful in 34s
CI / release (push) Skipped
CI / deploy (push) Successful in 1m23s

- 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:
openhands committed 2026-08-17 22:02:21 +02:00
1 parent 54f2bc5e0c
commit f285a7cd98
42 files changed
+1616 -1205

No files matched your search

+9 -8
View File
@@ -60,9 +60,11 @@ export default async function PollDetailPage({
const isOpen = poll.status === "active" && !hasEnded;
const questionIds = questions.map((q) => q.id);
const myVotes =
// My votes and the aggregate results are independent — load them together.
const [myVotes, allVotes] = await Promise.all([
Number.isInteger(userId) && userId > 0 && questionIds.length > 0
? await db
? db
.select()
.from(WebsitePollVote)
.where(
@@ -72,12 +74,9 @@ export default async function PollDetailPage({
),
)
.catch(() => [])
: [];
const hasVoted = myVotes.length > 0;
const allVotes =
: Promise.resolve([]),
poll.showResults === 1 && questionIds.length > 0
? await db
? db
.select({
questionId: WebsitePollVote.questionId,
answer: WebsitePollVote.answer,
@@ -85,7 +84,9 @@ export default async function PollDetailPage({
.from(WebsitePollVote)
.where(inArray(WebsitePollVote.questionId, questionIds))
.catch(() => [])
: [];
: Promise.resolve([]),
]);
const hasVoted = myVotes.length > 0;
const votesByQuestion = new Map<number, string[]>();
for (const vote of allVotes) {