Spaces:
Paused
Paused
fix: ranking-detail·yt-trailer가 캐시 miss 시 pending만 반환하던 문제
Browse files증상: 키노라이츠 랭킹 클릭 시 상세가 거의 안 나오고 YouTube 트레일러도 안 보임.
캐시된 작품만 반환, 새 작품/덜 본 작품은 영원히 {"pending":true}만 반환되던 상태.
원인: /api/ranking-detail, /api/yt-trailer 라우터가 fetchIfMissing 옵션 안 넘김.
함수 내부에서 cache miss + !fetchIfMissing → 즉시 {pending:true} 반환하고 종료.
클라이언트가 polling 안 하니 사용자는 영원히 빈 상태.
조치: 두 라우터에 { fetchIfMissing: true } 추가. 사용자 클릭 시점에 즉시 가져옴.
응답 시간 늘어남(2-10초)이 우려되지만 한번 가져오면 영구 캐시라 다음부터 0.8초.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
server.js
CHANGED
|
@@ -2149,8 +2149,8 @@ async function handleApi(req, res, parsed) {
|
|
| 2149 |
}
|
| 2150 |
}
|
| 2151 |
else if (p === '/api/ranking') out = await fetchKinoRanking(q.period, { fetchIfMissing: true, force: !!q.force });
|
| 2152 |
-
else if (p === '/api/ranking-detail') out = await fetchKinoDetail(q.id);
|
| 2153 |
-
else if (p === '/api/yt-trailer') out = await fetchYoutubeTrailer(q.title);
|
| 2154 |
else if (p === '/api/favs') {
|
| 2155 |
const profile = q.profile || '1';
|
| 2156 |
if (req.method === 'GET') {
|
|
|
|
| 2149 |
}
|
| 2150 |
}
|
| 2151 |
else if (p === '/api/ranking') out = await fetchKinoRanking(q.period, { fetchIfMissing: true, force: !!q.force });
|
| 2152 |
+
else if (p === '/api/ranking-detail') out = await fetchKinoDetail(q.id, { fetchIfMissing: true });
|
| 2153 |
+
else if (p === '/api/yt-trailer') out = await fetchYoutubeTrailer(q.title, { fetchIfMissing: true });
|
| 2154 |
else if (p === '/api/favs') {
|
| 2155 |
const profile = q.profile || '1';
|
| 2156 |
if (req.method === 'GET') {
|