feature: extend default card cache time to 6 hours (#3242)

* feature: extend default card cache time to 8 hours

* reduce to six hours
This commit is contained in:
Alexandr Garbuzov
2023-09-19 11:54:27 +02:00
committed by GitHub
parent eb787af325
commit 2ee803fc16
9 changed files with 45 additions and 33 deletions
+3 -3
View File
@@ -34,8 +34,8 @@ export default async (req, res) => {
const gistData = await fetchGist(id);
let cacheSeconds = clampValue(
parseInt(cache_seconds || CONSTANTS.FOUR_HOURS, 10),
CONSTANTS.FOUR_HOURS,
parseInt(cache_seconds || CONSTANTS.SIX_HOURS, 10),
CONSTANTS.SIX_HOURS,
CONSTANTS.ONE_DAY,
);
cacheSeconds = process.env.CACHE_SECONDS
@@ -52,7 +52,7 @@ export default async (req, res) => {
const isBothOver1K = stars > 1000 && forks > 1000;
const isBothUnder1 = stars < 1 && forks < 1;
if (!cache_seconds && (isBothOver1K || isBothUnder1)) {
cacheSeconds = CONSTANTS.FOUR_HOURS;
cacheSeconds = CONSTANTS.SIX_HOURS;
}
res.setHeader(
+1 -1
View File
@@ -58,7 +58,7 @@ export default async (req, res) => {
let cacheSeconds = clampValue(
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
CONSTANTS.FOUR_HOURS,
CONSTANTS.SIX_HOURS,
CONSTANTS.ONE_DAY,
);
cacheSeconds = process.env.CACHE_SECONDS
+2 -2
View File
@@ -41,7 +41,7 @@ export default async (req, res) => {
let cacheSeconds = clampValue(
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
CONSTANTS.FOUR_HOURS,
CONSTANTS.SIX_HOURS,
CONSTANTS.ONE_DAY,
);
cacheSeconds = process.env.CACHE_SECONDS
@@ -58,7 +58,7 @@ export default async (req, res) => {
const isBothOver1K = stars > 1000 && forks > 1000;
const isBothUnder1 = stars < 1 && forks < 1;
if (!cache_seconds && (isBothOver1K || isBothUnder1)) {
cacheSeconds = CONSTANTS.FOUR_HOURS;
cacheSeconds = CONSTANTS.SIX_HOURS;
}
res.setHeader(
+1 -1
View File
@@ -64,7 +64,7 @@ export default async (req, res) => {
let cacheSeconds = clampValue(
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
CONSTANTS.FOUR_HOURS,
CONSTANTS.SIX_HOURS,
CONSTANTS.ONE_DAY,
);
cacheSeconds = process.env.CACHE_SECONDS
+1 -1
View File
@@ -43,7 +43,7 @@ export default async (req, res) => {
let cacheSeconds = clampValue(
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
CONSTANTS.FOUR_HOURS,
CONSTANTS.SIX_HOURS,
CONSTANTS.ONE_DAY,
);
cacheSeconds = process.env.CACHE_SECONDS