Spaces:
Sleeping
Sleeping
Commit ·
c418fdb
1
Parent(s): 542e5d3
fix: disable all caching in leaderboard API for real-time updates
Browse files
app/api/leaderboard/route.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import { HF_DATASET_BASE_URL, MAX_DOCS_TO_SCAN } from '../../../utils/config.js';
|
| 2 |
|
|
|
|
|
|
|
| 3 |
/**
|
| 4 |
* GET /api/leaderboard
|
| 5 |
* Returns annotator rankings based on validation counts.
|
|
@@ -9,7 +11,7 @@ export async function GET() {
|
|
| 9 |
const linksUrl = `${HF_DATASET_BASE_URL}/raw/main/annotation_data/wbg_data/wbg_pdf_links.json`;
|
| 10 |
const linksRes = await fetch(linksUrl, {
|
| 11 |
headers: { 'Authorization': `Bearer ${process.env.HF_TOKEN}` },
|
| 12 |
-
|
| 13 |
});
|
| 14 |
|
| 15 |
if (!linksRes.ok) {
|
|
@@ -28,7 +30,8 @@ export async function GET() {
|
|
| 28 |
activeLinks.map(async (link) => {
|
| 29 |
const docUrl = `${HF_DATASET_BASE_URL}/raw/main/annotation_data/wbg_extractions/doc_${link.index}/raw/doc_${link.index}_direct_judged.jsonl`;
|
| 30 |
const docRes = await fetch(docUrl, {
|
| 31 |
-
headers: { 'Authorization': `Bearer ${process.env.HF_TOKEN}` }
|
|
|
|
| 32 |
});
|
| 33 |
if (!docRes.ok) return;
|
| 34 |
|
|
@@ -79,7 +82,7 @@ export async function GET() {
|
|
| 79 |
status: 200,
|
| 80 |
headers: {
|
| 81 |
'Content-Type': 'application/json',
|
| 82 |
-
'Cache-Control': '
|
| 83 |
}
|
| 84 |
});
|
| 85 |
} catch (error) {
|
|
|
|
| 1 |
import { HF_DATASET_BASE_URL, MAX_DOCS_TO_SCAN } from '../../../utils/config.js';
|
| 2 |
|
| 3 |
+
export const dynamic = 'force-dynamic'; // disable Next.js route caching
|
| 4 |
+
|
| 5 |
/**
|
| 6 |
* GET /api/leaderboard
|
| 7 |
* Returns annotator rankings based on validation counts.
|
|
|
|
| 11 |
const linksUrl = `${HF_DATASET_BASE_URL}/raw/main/annotation_data/wbg_data/wbg_pdf_links.json`;
|
| 12 |
const linksRes = await fetch(linksUrl, {
|
| 13 |
headers: { 'Authorization': `Bearer ${process.env.HF_TOKEN}` },
|
| 14 |
+
cache: 'no-store'
|
| 15 |
});
|
| 16 |
|
| 17 |
if (!linksRes.ok) {
|
|
|
|
| 30 |
activeLinks.map(async (link) => {
|
| 31 |
const docUrl = `${HF_DATASET_BASE_URL}/raw/main/annotation_data/wbg_extractions/doc_${link.index}/raw/doc_${link.index}_direct_judged.jsonl`;
|
| 32 |
const docRes = await fetch(docUrl, {
|
| 33 |
+
headers: { 'Authorization': `Bearer ${process.env.HF_TOKEN}` },
|
| 34 |
+
cache: 'no-store'
|
| 35 |
});
|
| 36 |
if (!docRes.ok) return;
|
| 37 |
|
|
|
|
| 82 |
status: 200,
|
| 83 |
headers: {
|
| 84 |
'Content-Type': 'application/json',
|
| 85 |
+
'Cache-Control': 'no-cache, no-store, must-revalidate'
|
| 86 |
}
|
| 87 |
});
|
| 88 |
} catch (error) {
|