add database bypass header

This commit is contained in:
martin-mfg
2025-06-22 08:01:07 +00:00
parent 76a9b8395d
commit a0060f0231
+8 -2
View File
@@ -15,6 +15,9 @@ export async function storeRequest(req) {
if (!pool) {
return;
}
if (req.headers && req.headers["x-bypass-store"]) {
return;
}
const insertQuery = `
INSERT INTO requests (request, requested_at)
@@ -96,12 +99,15 @@ async function makeRequests(urls, poolSize) {
if (idx >= urls.length) {
break;
}
const url = "http://" + process.env.VERCEL_BRANCH_URL + urls[idx];
const url = "https://" + process.env.VERCEL_BRANCH_URL + urls[idx];
try {
if (idx % 10 === 0) {
console.log(`Processing request ${idx + 1} out of ${urls.length}`);
}
await axios.get(url, { timeout: 10000 });
await axios.get(url, {
timeout: 10000,
headers: { "x-bypass-store": "true" },
});
} catch (err) {
console.error(`Error fetching ${url}:`, err.message);
}