docs: update documentation for real-time privacy policy and remove server cache

This commit is contained in:
2026-05-23 13:43:14 +09:00
parent 41d3f4db7c
commit f459585cec
4 changed files with 22 additions and 17 deletions
+10 -12
View File
@@ -40,27 +40,27 @@ const DEFAULT_PRIVACY_POLICY_MARKDOWN = `
**시행일자**: 2026년 5월 23일
`;
let aboutCache;
let aboutIndexesReady;
let aboutWarmupPromise;
export async function aboutRoutes(fastify) {
fastify.get("/about", async () => getAboutContent());
fastify.get("/about/", async () => getAboutContent());
// 관리용: 초기 데이터 보장 및 인덱스 생성을 위한 명시적 호출용 (필요시)
fastify.post("/about/warmup", async (request, reply) => {
await warmAboutContent();
return { success: true };
});
}
export async function warmAboutContent() {
if (!hasMongoConfig()) {
aboutCache = formatAboutContent();
return aboutCache;
return formatAboutContent();
}
if (!aboutWarmupPromise) {
aboutWarmupPromise = loadAboutContent()
.then((content) => {
aboutCache = content;
return content;
})
.finally(() => {
aboutWarmupPromise = undefined;
});
@@ -70,15 +70,13 @@ export async function warmAboutContent() {
}
async function getAboutContent() {
if (aboutCache) {
return aboutCache;
}
return warmAboutContent();
// 실시간 반영을 위해 캐시를 사용하지 않고 매번 DB에서 로드
return loadAboutContent();
}
async function loadAboutContent() {
const collection = await getAboutCollection();
// 서버 시작 시나 첫 호출 시 기본값 보장 (이미 있으면 유지됨)
await ensureAboutDefaults(collection);
const [developerInfo, privacyPolicy] = await Promise.all([