perf: 공유 지도와 토너먼트 revision을 원자화
지도 캐시는 coverage가 확인된 PostgreSQL map.world head만 사용하고 실패 시 전체 계산으로 복구한다. 토너먼트 Redis payload와 source revision은 Lua 한 번으로 갱신한다.
This commit is contained in:
@@ -131,11 +131,12 @@ export const tournamentRouter = router({
|
||||
getSnapshot: accessAuthedProcedure.query(async ({ ctx }) => {
|
||||
await getMyGeneral(ctx);
|
||||
const store = new TournamentStore(ctx.redis, buildTournamentKeys(ctx.profile.name));
|
||||
const [state, participants, matches, bets] = await Promise.all([
|
||||
const [state, participants, matches, bets, sourceRevision] = await Promise.all([
|
||||
store.getState(),
|
||||
store.getParticipants(),
|
||||
store.getMatches(),
|
||||
store.getBettingEntries(),
|
||||
store.getSourceRevision(),
|
||||
]);
|
||||
const participantIds = [...new Set(participants.map((participant) => participant.id))];
|
||||
const iconRows =
|
||||
@@ -154,7 +155,7 @@ export const tournamentRouter = router({
|
||||
imageServer: icon?.imageServer ?? 0,
|
||||
};
|
||||
});
|
||||
return { state, participants: publicParticipants, matches, betCount: bets.length };
|
||||
return { state, participants: publicParticipants, matches, betCount: bets.length, sourceRevision };
|
||||
}),
|
||||
getRankings: authedProcedure.query(async ({ ctx }) => {
|
||||
await getMyGeneral(ctx);
|
||||
|
||||
Reference in New Issue
Block a user