mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-06-01 12:12:52 +00:00
fix: increase cache
This commit is contained in:
+2
-2
@@ -42,8 +42,8 @@ module.exports = async (req, res) => {
|
||||
}
|
||||
|
||||
const cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.THIRTY_MINUTES, 10),
|
||||
CONSTANTS.THIRTY_MINUTES,
|
||||
parseInt(cache_seconds || CONSTANTS.TWO_HOURS, 10),
|
||||
CONSTANTS.TWO_HOURS,
|
||||
CONSTANTS.ONE_DAY
|
||||
);
|
||||
|
||||
|
||||
+3
-3
@@ -32,8 +32,8 @@ module.exports = async (req, res) => {
|
||||
}
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.THIRTY_MINUTES, 10),
|
||||
CONSTANTS.THIRTY_MINUTES,
|
||||
parseInt(cache_seconds || CONSTANTS.TWO_HOURS, 10),
|
||||
CONSTANTS.TWO_HOURS,
|
||||
CONSTANTS.ONE_DAY
|
||||
);
|
||||
|
||||
@@ -47,7 +47,7 @@ module.exports = async (req, res) => {
|
||||
const isBothOver1K = stars > 1000 && forks > 1000;
|
||||
const isBothUnder1 = stars < 1 && forks < 1;
|
||||
if (!cache_seconds && (isBothOver1K || isBothUnder1)) {
|
||||
cacheSeconds = CONSTANTS.TWO_HOURS;
|
||||
cacheSeconds = CONSTANTS.FOUR_HOURS;
|
||||
}
|
||||
|
||||
res.setHeader("Cache-Control", `public, max-age=${cacheSeconds}`);
|
||||
|
||||
+2
-2
@@ -34,8 +34,8 @@ module.exports = async (req, res) => {
|
||||
}
|
||||
|
||||
const cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.THIRTY_MINUTES, 10),
|
||||
CONSTANTS.THIRTY_MINUTES,
|
||||
parseInt(cache_seconds || CONSTANTS.TWO_HOURS, 10),
|
||||
CONSTANTS.TWO_HOURS,
|
||||
CONSTANTS.ONE_DAY
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user