feature: fetch only requested data from GitHub GraphQL API to reduce load (#3208)

* feature: fetch only requested data from GitHub GraphQL API to reduce load

* dev

* dev
This commit is contained in:
Alexandr Garbuzov
2023-10-13 22:14:06 +03:00
committed by GitHub
parent 7b1b78df2f
commit 1c07f4142c
3 changed files with 135 additions and 38 deletions
+6 -1
View File
@@ -50,10 +50,15 @@ export default async (req, res) => {
}
try {
const showStats = parseArray(show);
const stats = await fetchStats(
username,
parseBoolean(include_all_commits),
parseArray(exclude_repo),
showStats.includes("prs_merged") ||
showStats.includes("prs_merged_percentage"),
showStats.includes("discussions_started"),
showStats.includes("discussions_answered"),
);
let cacheSeconds = clampValue(
@@ -96,7 +101,7 @@ export default async (req, res) => {
locale: locale ? locale.toLowerCase() : null,
disable_animations: parseBoolean(disable_animations),
rank_icon,
show: parseArray(show),
show: showStats,
}),
);
} catch (err) {